CAMEL-22544: jbang dependency update supports multi-file and --scan-routes#22208
CAMEL-22544: jbang dependency update supports multi-file and --scan-routes#22208
Conversation
|
🌟 Thank you for your contribution to the Apache Camel project! 🌟 🐫 Apache Camel Committers, please review the following items:
|
…outes - Accept multiple target files (pom.xml or Java source files with //DEPS) - Add --scan-routes flag to sync dependencies from route definitions: - Manages only org.apache.camel dependencies - Preserves non-Camel dependencies - Removes unused Camel dependencies - Idempotent on re-execution - Route files (YAML, XML) passed as arguments are used as source files for the export pipeline dependency resolution - In scan-routes mode, Camel //DEPS in Java target files are stripped before export to prevent stale deps from being resolved Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
🧪 CI tested the following changed modules:
All tested modules (26 modules)
|
| assertThat(content2).contains("//DEPS org.apache.camel:camel-bom:"); | ||
| } | ||
|
|
||
| private void prepareMavenProject(RuntimeType rt) throws Exception { |
There was a problem hiding this comment.
Calling jbang init and export for each test is not good for tests in CI, since it will take time to invoke and write files. I suggest to have the files ready at src/test/resources, this way the test class is less hassle to maintain and easier to understand.
There was a problem hiding this comment.
Good point. The new scan-routes Maven tests now use fixture files from src/test/resources/dependency-update/ (pom.xml per runtime + route YAML), copied into the temp working directory at test setup time — no Init+Export invocation needed. The existing shouldDependencyUpdate test still uses Init+Export since it validates the "no updates on fresh project" invariant which requires exact dependency matching.
Claude Code on behalf of Guillaume Nodet
|
|
||
| import static org.assertj.core.api.Assertions.assertThat; | ||
|
|
||
| class DependencyUpdateJBangTest extends CamelCommandBaseTestSupport { |
There was a problem hiding this comment.
Having a single DependencyUpdateTest class is easier to maintain, instead 2 files to the same DependencyUpdate command.
There was a problem hiding this comment.
Done — merged all tests from DependencyUpdateJBangTest into DependencyUpdateTest. Single test class now covers Maven dependency update, scan-routes (Maven), and JBang //DEPS scenarios.
Claude Code on behalf of Guillaume Nodet
- Merge DependencyUpdateJBangTest into DependencyUpdateTest (single test class) - Use fixture files from src/test/resources for scan-routes Maven tests instead of calling Init+Export at runtime - Add input validation preventing mixed pom.xml and Java targets - Guard addMavenDeps against targetLineNumber == -1 - Clean up blank lines left by removeMavenDeps - Clarify isCamelDependency javadoc on group prefix matching - Fix PrepareCamelJBangCommandsMojo regex to match 'this' (not just 'main') as constructor arg, fixing stale metadata generation - Regenerate all jbang command metadata and docs Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
JIRA: CAMEL-22544
Summary
camel dependency updatecommand to accept multiple target files (pom.xml or Java source files with//DEPS)--scan-routesflag to sync dependencies from route definitions:org.apache.cameldependencies//DEPSin Java target files are stripped before running the export pipeline, so only actual route-based dependencies are resolvedPrepareCamelJBangCommandsMojoregex to matchthis(not justmain) as constructor arg, fixing stale metadata generationTest plan
DependencyUpdateTest(Maven pom.xml with quarkus, spring-boot, main runtimes) passessrc/test/resources/dependency-update/(no Init+Export at runtime):--scan-routesadds new deps from routes (Maven, all runtimes)--scan-routesremoves unused Camel deps from pom.xml--scan-routesadds and removes deps simultaneously//DEPStests (inline fixtures)://DEPSupdate--scan-routespreserves non-Camel//DEPSin JBang files--scan-routesis idempotent on re-execution