smongiar opened a new pull request, #23781: URL: https://github.com/apache/camel/pull/23781
## Summary - The `--kamelets-version` option in `camel export` was hardcoded to a compile-time default from `parent/pom.xml` (`RuntimeType.KAMELETS_VERSION`) - `VersionHelper.extractKameletsVersion()` can detect the actual kamelets jar version from the classpath, but the null-check at `resolveDependencies()` never triggers because the field is always pre-initialized - Remove the compile-time default so `extractKameletsVersion()` runs at runtime, detecting the actual version from the classpath and falling back to the compiled-in default only when no kamelets jar is found - Add the same null-check in `runSilently()` which runs before `resolveDependencies()` ## Problem When running `camel export --runtime=spring-boot` without explicit `--kamelets-version`, the generated `pom.xml` always uses the version compiled into `RuntimeType.KAMELETS_VERSION`. If the actual `camel-kamelets` jar on the classpath has a different version (e.g. in downstream/productized builds), the exported project gets the wrong kamelets dependency. ## Reproducer ```bash # Install a camel CLI with kamelets 4.18.x on the classpath # Then export without --kamelets-version: camel export --runtime=spring-boot --gav=com.example:test:1.0.0 --dir=./app MyRoute.java # Before fix: pom.xml has <version>4.17.0</version> for camel-kamelets (compiled-in default) # After fix: pom.xml has <version>4.18.x</version> (detected from classpath) ``` ## Test plan - [x] Verified `VersionHelper.extractKameletsVersion()` regex matches versioned jar names including qualifiers (e.g., `camel-kamelets-4.18.1.redhat-00021.jar`) - [x] Existing tests pass — when no kamelets jar is on the classpath, `extractKameletsVersion()` falls back to `KameletCatalogHelper.KAMELETS_VERSION` (same behavior as before) -- 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]
