Fix camel export to auto-detect kamelets version from classpath#23781
Conversation
|
After these changes, is |
5cf111e to
b6cf1a6
Compare
So, I updated the fix removing the defaultValue and field initializer, adding a null check that calls |
|
🌟 Thank you for your contribution to the Apache Camel project! 🌟 🐫 Apache Camel Committers, please review the following items:
|
b6cf1a6 to
ab50f1e
Compare
davsclaus
left a comment
There was a problem hiding this comment.
Well-scoped fix. The compile-time default for kameletsVersion masked the runtime classpath detection, causing exported projects to always use the compiled-in version rather than the actual kamelets jar version. The fix consistently removes the pre-initialization across all 4 commands (ExportBaseCommand, CatalogKamelet, CatalogDoc, KameletTools) and lets VersionHelper.extractKameletsVersion() detect the real version at runtime. Documentation updated across 7 command reference pages.
This review does not replace specialized AI review tools (CodeRabbit, Sourcery) or static analysis (SonarCloud).
This review was generated by an AI agent and may contain inaccuracies. Please verify all suggestions before applying.
|
There are uncommitted changes |
ab50f1e to
1f24360
Compare
The --kamelets-version option was hardcoded to a compile-time default from parent/pom.xml in ExportBaseCommand, CatalogKamelet, CatalogDoc, and KameletTools. When the actual kamelets jar on the classpath has a different version (e.g. in productized builds), wrong version is used. Remove the compile-time defaults and let VersionHelper.extractKameletsVersion() detect the actual version from the classpath at runtime, falling back to the compiled-in default only when no kamelets jar is found.
1f24360 to
7863ccb
Compare
|
🧪 CI tested the following changed modules:
💡 Manual integration tests recommended:
All tested modules (6 modules)
|
Summary
--kamelets-versionoption incamel exportwas hardcoded to a compile-time default fromparent/pom.xml(RuntimeType.KAMELETS_VERSION)VersionHelper.extractKameletsVersion()can detect the actual kamelets jar version from the classpath, but the null-check atresolveDependencies()never triggers because the field is always pre-initializedextractKameletsVersion()runs at runtime, detecting the actual version from the classpath and falling back to the compiled-in default only when no kamelets jar is foundrunSilently()which runs beforeresolveDependencies()Problem
When running
camel export --runtime=spring-bootwithout explicit--kamelets-version, the generatedpom.xmlalways uses the version compiled intoRuntimeType.KAMELETS_VERSION. If the actualcamel-kameletsjar on the classpath has a different version (e.g. in downstream/productized builds), the exported project gets the wrong kamelets dependency.Reproducer