davsclaus opened a new pull request, #30682: URL: https://github.com/apache/camel/pull/30682
_Claude Code on behalf of davsclaus_ [CAMEL-27476](https://issues.apache.org/jira/browse/CAMEL-27476) ### Problem The launcher bundles a camel-kamelets jar: `//DEPS org.apache.camel.kamelets:camel-kamelets:${camel-kamelets.version:4.22.0}` in `CamelJBang.java`, and camel-launcher bundles 4.23.0. `camel run --kamelets-version=X` downloads camel-kamelets X into `DependencyDownloaderClassLoader`, which asks its parent first. So a Kamelet that exists in both jars was loaded from the launcher's version, and only Kamelets new in X came from X. Seen with `--kamelets-version=4.24.0-SNAPSHOT`: the 4.22 `postgresql-sink` (which has no dataTypes) was used, and the route failed with "Cannot unmarshal using jackson: the body is a Map". ### Fix `DependencyDownloaderClassLoader.getResource` looks up a `kamelets/` resource in the downloaded jars first. Any other resource is still parent first. - Without `--kamelets-version`, nothing changes: the version of the launcher's jar is the default, so nothing is downloaded and the launcher's Kamelets are used. - A `--background` run passes `--kamelets-version` to its JVM, so its Kamelets come from the jar it downloads as well. ### Tests - `DependencyDownloaderClassLoaderTest`: the downloaded Kamelet wins, a Kamelet only the launcher has is still found, other resources are still parent first, and a `classpath:kamelets/...` resource of a CamelContext resolves to the downloaded Kamelet. Without the fix, 2 of the 3 tests fail with `expected: <4.24> but was: <4.22>`. - All tests of camel-kamelet-main pass. - End to end with the 4.24.0-SNAPSHOT launcher classpath, which has camel-kamelets 4.22.0 on it: `camel run --kamelets-version=4.24.0-SNAPSHOT` with `kamelet:log-sink` and `dumpRoutesInclude=routeTemplates` dumps the 4.22 `log-sink` template before the fix and the 4.24 one after. The two files list the log parameters in a different order. Not tested end to end: `--background`. Its JVM runs the installed `camel`, not the jar of this branch. Not in this PR: the launcher default (4.22.0) and `camel-kamelets-catalog-version` (4.23.0) stay as they are. They go with the move of Kamelets into Camel in 4.25. 🤖 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]
