Claus Ibsen created CAMEL-25349:
-----------------------------------

             Summary: camel-jbang - camel run . --dev does not reload changed 
or new route files
                 Key: CAMEL-25349
                 URL: https://issues.apache.org/jira/browse/CAMEL-25349
             Project: Camel
          Issue Type: Bug
          Components: camel-jbang
            Reporter: Claus Ibsen


Running a directory, such as {{camel run . --dev}}, never reloads a route file 
when it is saved, and a new route file added to the directory is not loaded.

The directory is expanded into a list of files ({{RunHelper.dirToFiles}}), 
named {{./orders.camel.yaml}}. In dev mode these names become the reload 
pattern, and {{RouteWatcherReloadStrategy}} matches the pattern against 
{{orders.camel.yaml}} (the file name, the path relative to the folder, and the 
compacted path), so nothing matches and nothing is reloaded. As the pattern is 
a fixed list of files, a new file in the directory would not be picked up 
either.

{{camel run --source-dir=. --dev}} works: changes are reloaded and new files 
are loaded.

Reproduce: a directory with one route file, {{camel run . --dev}}, change the 
file: no reload; add another route file: not loaded.

Fix:
* a single directory argument ({{camel run .}} or {{camel run dir}}) runs the 
directory as {{--source-dir}}, unless it is a Maven project (has a pom.xml), 
which keeps running its files as before
* {{RunHelper.dirToFiles}} names the files without a leading {{./}}, so a file 
list of the current directory also matches the reload pattern (also used by 
export, dependency list, SBOM and the Kubernetes plugin)

_Claude Code on behalf of Claus Ibsen_



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to