Dominik Jelinek created CAMEL-24628:
---------------------------------------
Summary: camel-cli: dependency update silently drops route files
passed as positional arguments
Key: CAMEL-24628
URL: https://issues.apache.org/jira/browse/CAMEL-24628
Project: Camel
Issue Type: Bug
Components: camel-jbang
Affects Versions: 4.22.0, 4.21.0
Reporter: Dominik Jelinek
Since CAMEL-22544, passing a route file alongside pom.xml as positional
arguments
to `camel dependency update` no longer works. The route file is silently dropped
and no dependency resolution occurs.
h3. Steps to reproduce
1. Have a Quarkus Maven project with a Camel route that uses the SQL component
2. Run: {{camel dependency update pom.xml
src/main/resources/camel/route.camel.yaml --lazy-bean --ignore-loading-error}}
3. Observe: command exits 0 but pom.xml is NOT updated with
{{camel-quarkus-sql}}
*This worked correctly in Camel 4.20.*
h3. Root cause
CAMEL-22544 changed {{@Parameters(arity="1")}} to {{@Parameters(arity="1..*")}}
in {{{}DependencyUpdate.java{}}}. This causes ALL positionals to be consumed by
{{{}DependencyUpdate.targetFiles{}}}. Non-update files (YAML/XML) are classified
correctly but never propagated to {{{}ExportBaseCommand.files{}}}, so the export
pipeline runs with no routes.
The {{@Parameters}} description says "Route definition files (YAML, XML) can
also be included and will be used as source files for dependency resolution"
but the code never implements this.
h3. Impact
IDE tooling uses the two-argument convention
{{{}camel dependency update pom.xml route.yaml{}}}, as seen in prior issues
CAMEL-22447 and CAMEL-22446. This regression breaks the Maven dependency
update feature in these tools when upgrading from Camel 4.20 to 4.21+/4.22.
h3. Suggested fix
In {{{}DependencyUpdate.doCall(){}}}, add an {{else}} branch that forwards
non-target files to {{{}this.files{}}}:
{code:java}
if ("pom.xml".equals(name) || "java".equals(ext)) {
updateTargets.add(file);
} else {
// route files → pass to export pipeline for dependency resolution
this.files.add(file.toString());
}
{code}
--
This message was sent by Atlassian Jira
(v8.20.10#820010)