Serdar Gökay created CAMEL-26697:
------------------------------------
Summary: camel-jbang - export for camel-main still names
camel-micrometer-prometheus twice when camel.metrics.enabled is set
Key: CAMEL-26697
URL: https://issues.apache.org/jira/browse/CAMEL-26697
Project: Camel
Issue Type: Bug
Components: camel-jbang
Affects Versions: 4.23.0
Reporter: Serdar Gökay
CAMEL-24247 aligned the notation that the camel-main export adds for metrics.
That covers a project that sets only {{camel.management.metricsEnabled}}. With
{{camel.metrics.enabled=true}} the exported pom.xml still names
camel-micrometer-prometheus twice on 4.23.0.
*Steps to reproduce:*
{noformat}
application.properties:
camel.metrics.enabled=true
demo.camel.yaml:
a timer route with a log step
camel export application.properties demo.camel.yaml --gav=example:demo:1
--runtime=camel-main --dir=out
{noformat}
out/pom.xml has two camel-micrometer-prometheus dependencies. With only
{{camel.management.metricsEnabled=true}} it has one.
*What happens:*
# The run that export uses to detect dependencies loads the component, so
.camel-jbang/camel-jbang-run.properties records
{{dependency=mvn:org.apache.camel:camel-micrometer-prometheus:4.23.0}}.
# {{ExportBaseCommand.resolveDependencies}} removes duplicates by
groupId:artifactId and keeps that entry.
# {{ExportCamelMain.resolveDependencies}} then adds
{{camel:micrometer-prometheus}} because the property is set. The set compares
strings, so both entries stay.
{{CamelMainExporter}} on main has the same order.
*Effect:* Maven 3.9 warns. Maven 3.10.0 fails the build:
{noformat}
[ERROR] 'dependencies.dependency.(groupId:artifactId:type:classifier)' must be
unique: org.apache.camel:camel-micrometer-prometheus:jar -> duplicate
declaration of version (?)
{noformat}
*Proposed change:* remove duplicates once after the runtime-specific additions,
or make those additions before duplicates are removed. The other additions in
that method (camel:health, the console artifacts) take the same path. We can
send a pull request.
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)