CAMEL-24247: camel-jbang - Fix duplicate camel-micrometer-prometheus in exported pom.xml - #25035
Conversation
…in exported pom.xml Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> Signed-off-by: Claus Ibsen <claus.ibsen@gmail.com>
|
🌟 Thank you for your contribution to the Apache Camel project! 🌟 🐫 Apache Camel Committers, please review the following items:
|
|
🧪 CI tested the following changed modules:
🔬 Scalpel shadow comparison — Scalpel: 7 tested, 8 compile-only — current: 6 all testedMaveniverse Scalpel detected 15 affected modules (current approach: 6).
|
davsclaus
left a comment
There was a problem hiding this comment.
Claude Code on behalf of davsclaus
The removeIf pattern s.contains("camel-micrometer-prometheus") does not match the camel:micrometer-prometheus entry added by the base class (ExportBaseCommand.java:778) — the colon vs dash means the substring check fails, so the duplicate persists.
Suggested approach: drop the new removeIf line and change line 305 to use camel:micrometer-prometheus shorthand instead of the mvn: format. The Set naturally deduplicates the identical string the base class already added. The same cleanup could be done for camel-health at line 309 → camel:health for consistency.
This review does not replace specialized tools such as CodeRabbit, Sourcery, or SonarCloud.
This review was generated by an AI agent and may contain inaccuracies. Please verify all suggestions before applying.
Use camel: shorthand instead of mvn: format for micrometer-prometheus and health dependencies. The Set naturally deduplicates identical strings, avoiding the need for a removeIf workaround. Added test to verify no duplicate camel-micrometer-prometheus in exported pom.xml. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> Signed-off-by: Claus Ibsen <claus.ibsen@gmail.com>
Summary
Claude Code on behalf of davsclaus
Fixes CAMEL-24247.
When exporting a JBang project with metrics enabled, the exported pom.xml contains
camel-micrometer-prometheustwice. The base classExportBaseCommand.resolveDependencies()addscamel:micrometer-prometheus(shorthand format) at line 778, then the subclassExportCamelMain.resolveDependencies()addsmvn:org.apache.camel:camel-micrometer-prometheus(full format) at line 305. Since these are different strings, theSetdoes not deduplicate them, and both end up in the generated pom.xml.Fix: Switch the subclass to use
camel:micrometer-prometheusshorthand (matching the base class format) so theSetnaturally deduplicates. Applied the same fix forcamel-health. NoremoveIfworkaround needed.Test plan
shouldNotDuplicateMetricsDependencytest that exports withcamel.management.metricsEnabled=trueand assertscamel-micrometer-prometheusappears exactly once🤖 Generated with Claude Code
Co-Authored-By: Claude Opus 4.6 noreply@anthropic.com