etzel-mes opened a new pull request, #29353:
URL: https://github.com/apache/camel/pull/29353

   # Description
   
   `camel export` wrote a `pom.xml` that names the same artifact twice. Maven 
3.9 warns about that, and Maven 3.10.0 (2026-09-27) fails the build; the 
exported project carries the 3.9.12 wrapper, so the failure appears when the 
project is built with a Maven of its own, as a build pipeline does.
   
   Two mechanisms produce such a pom, and this pull request has one commit for 
each.
   
   **The notation.** `Exporter.resolveDependencies` collects the dependencies 
and removes the duplicates per groupId:artifactId as its last step. The three 
runtime exporters override it, call `super` first and then add their own 
dependencies, so what they add is not deduplicated — and an artifact in the 
`camel:` notation is a different string from the 
`mvn:org.apache.camel:camel-...:<version>` that the recorded run holds. 
CAMEL-24247 changed the notation of the camel-main metrics and health 
dependencies for this reason; that holds only where the base exporter adds the 
identical string before the duplicates are removed.
   
   **The mapping.** The duplicates are removed by the coordinates as written, 
while each runtime maps the dependencies to its own artifacts afterwards 
(`camel-x` → `camel-quarkus-x`, `camel-x` → `camel-x-starter`, and the 
`quarkus-dependencies.properties` replacements). Two dependencies with 
different written coordinates become the same artifact there.
   
   | Export | Named twice before |
   | --- | --- |
   | `--runtime=camel-main`, `camel.metrics.enabled=true` | 
camel-micrometer-prometheus |
   | `--runtime=camel-main --console`, console options in 
application.properties | camel-console, camel-management, camel-health, 
camel-platform-http-main, camel-platform-http-jolokia |
   | `--runtime=quarkus --console`, the same | camel-quarkus-console, 
camel-quarkus-management |
   | `--runtime=spring-boot --console`, the same | camel-console-starter, 
camel-management-starter |
   | `--runtime=quarkus --console 
--dep=org.apache.camel.quarkus:camel-quarkus-console` | camel-quarkus-console |
   | `--runtime=spring-boot --console 
--dep=org.apache.camel.springboot:camel-console-starter` | 
camel-console-starter |
   
   The change:
   
   - `resolveDependencies` is the step that removes the duplicates of the 
dependency strings and is `final`: it calls the overridable 
`doResolveDependencies` and deduplicates what comes back. The dependencies a 
runtime exporter adds are deduplicated as well, whatever notation they use.
   - A runtime exporter therefore sees the dependencies before the duplicates 
are removed. `CamelMainExporter` decided with 
`s.contains("mvn:org.apache.camel:camel-platform-http-main")` whether the main 
HTTP server is included, and removed `camel-platform-http` and `-vertx` by the 
same kind of string check, so a dependency given as `camel:platform-http` would 
have survived the removal. Those three checks compare artifacts 
(`hasCamelArtifact` / `removeCamelArtifact`).
   - The four places that build the pom's dependencies 
(`Exporter.buildDependencyList`, `QuarkusExporter.buildQuarkusDependencyList` 
after its replacements, `SpringBootExporter`'s list and its legacy catalog 
template) remove the duplicates of the mapped artifacts, with one rule in 
`ExportHelper.removeDuplicateArtifacts`: a single dependency per 
groupId:artifactId, the first, but one with a version wins over one without — 
the rule the string step already applies to an explicit `--dep` version. The 
pom entries keep their order, as the sort still runs last.
   - The `camel:` notation of CAMEL-24247 is kept; the fix does not revert it.
   
   Tests: `ExportTest.shouldNotDuplicateMetricsDependency` (the test of 
CAMEL-24247) now runs over the three metrics options; 
`shouldNotDuplicateConsoleDependencies` exports with `--console` and a profile 
that has the console options, for the three runtimes; 
`shouldNotDuplicateConsoleDependencyGivenAsRuntimeArtifact` adds a `--dep` with 
the runtime's own coordinates for Quarkus and Spring Boot. Each asserts that 
the exported `pom.xml` names every artifact once. Six of them fail without the 
two changes. `shouldReplacePlatformHttpInAnyNotation` pins the camel-main 
replacement for a dependency given as `camel:platform-http`, and 
`ExportHelperTest` has the rule of the second step on its own. 
`camel-jbang-run` (257 tests) and the whole `ExportTest` (157) pass.
   
   ## Please check the whole change
   
   - The duplicates are removed per groupId:artifactId, as the step before this 
change already did, so two entries of one artifact that differ only in 
classifier or packaging collapse as well. No export in the tests has such a 
pair, and this is the behaviour the export already had, so it is kept.
   - `SpringBootExporter` still asks 
`s.contains("mvn:org.apache.camel:camel-platform-http")` whether an HTTP server 
is included, the pattern the first commit replaced in `CamelMainExporter`. It 
does not see a dependency given as `camel:platform-http`, so the exported 
project gets `camel.main.run-controller=true` although it has a server. That is 
pre-existing and another symptom than this issue, so it is left alone here.
   - No upgrade-guide entry: no option, default or API changes; an exported 
`pom.xml` loses a line it should not have had.
   - CAMEL-24247 was backported to `camel-4.18.x`. Whether this one is 
backported is your call.
   - `mvn clean install -DskipTests` from the root folder was not run on this 
machine; `camel-jbang-run` and `camel-jbang-core` were built and their tests 
run, and the change feeds no generator.
   
   # Target
   
   - [x] I checked that the commit is targeting the correct branch (Camel 4 
uses the `main` branch)
   
   # Tracking
   
   - [x] [CAMEL-26697](https://issues.apache.org/jira/browse/CAMEL-26697)
   
   # Apache Camel coding standards and style
   
   - [x] I checked that each commit in the pull request has a meaningful 
subject line and body.
   - [ ] I have run `mvn clean install -DskipTests` locally from root folder 
and I have committed all auto-generated changes. (Only the two changed modules 
were built; see above.)
   
   # AI-assisted contributions
   
   - [x] If this PR includes AI-generated code, commits have proper 
co-authorship attribution (e.g., `Co-authored-by` trailers) and the PR 
description identifies the AI tool used.
   
   Written with Claude Code (Claude Opus 5 and Claude Fable 5.1), each commit 
reviewed by a separate Claude Fable 5.1 run.
   
   _Claude Code on behalf of etzel-mes_
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to