[ 
https://issues.apache.org/jira/browse/CAMEL-26370?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Ricardo Martinez updated CAMEL-26370:
-------------------------------------
    Summary: {{camel export --local-kamelet-dir=<dir1>,<dir2>}} silently 
produces a broken export when more than one directory is supplied on the 4.22.x 
branch.  (was: `camel export --local-kamelet-dir=<dir1>,<dir2>` silently 
produces a broken export when more than one directory is supplied on the 4.22.x 
branch.)

> {{camel export --local-kamelet-dir=<dir1>,<dir2>}} silently produces a broken 
> export when more than one directory is supplied on the 4.22.x branch.
> ---------------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: CAMEL-26370
>                 URL: https://issues.apache.org/jira/browse/CAMEL-26370
>             Project: Camel
>          Issue Type: Bug
>            Reporter: Ricardo Martinez
>            Priority: Trivial
>
> h2. Description
> The same two bugs present in the main/4.23 regression (see related issue) 
> also exist verbatim in {{ExportBaseCommand.copySourceFiles()}} on the 
> {{camel-4.22.x}} maintenance branch.
> On 4.22.x the {{camel run --runtime=camel-main}} code path is *not* affected 
> because commit {{935f581a8a59}} (CAMEL-24659) — which routed {{camel run 
> --runtime=camel-main}} through the export pipeline — was *never backported* 
> to that branch. In 4.22.x that command still runs in-process via 
> {{KameletMain}}, bypassing {{copySourceFiles()}} entirely.
> However, the *{{camel export}}* sub-command (all runtimes: camel-main, 
> quarkus, spring-boot) *does* call {{copySourceFiles()}} on 4.22.x, so any 
> user running:
> {code:bash}
> camel export --local-kamelet-dir=/path/to/dir1,/path/to/dir2 ...
> {code}
> will get a project where the kamelet files are missing — the copy step 
> silently fails to resolve the correct source path.
> h3. Root Cause
> Identical to the main/4.23 issue:
> *Bug 1* — {{getScheme()}} is called on the entire comma-joined 
> {{LOCAL_KAMELET_DIR}} string. Only the scheme from the first entry is 
> stripped; subsequent entries retain their {{file:}} prefix.
> *Bug 2* — {{Paths.get(localKameletDir, f + ".kamelet.yaml")}} is called with 
> the still-comma-joined string, producing a non-existent path that contains a 
> literal comma.
> h3. Affected File (on {{camel-4.22.x}})
> {{dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/ExportBaseCommand.java}}
>  — method {{copySourceFiles()}}, lines ~874–878 (scheme stripping) and 
> ~944–946 (path construction).
> h3. Relationship to Main Issue
> This issue covers the *{{camel-4.22.x}} backport* of the same fix. The fix on 
> main replaces the single {{localKameletDir}} string with a {{List<String>}}, 
> strips the scheme per element, and searches directories in order. The same 
> change applies cleanly to {{camel-4.22.x}}.
> h3. Workaround (until fixed)
> Pass only a single directory to {{--local-kamelet-dir}} — the most specific 
> one (e.g. the {{kamelets/}} subdirectory).
> ----
> _Filed by Bob (AI) on behalf of lordrip._



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to