Salvatore Mongiardo created CAMEL-27072:
-------------------------------------------

             Summary: camel-kamelet-main: Detect bundled Kamelets versions 
outside java.class.path
                 Key: CAMEL-27072
                 URL: https://issues.apache.org/jira/browse/CAMEL-27072
             Project: Camel
          Issue Type: Bug
          Components: camel-jbang
            Reporter: Salvatore Mongiardo
            Assignee: Salvatore Mongiardo


VersionHelper.extractKameletsVersion() looks for a camel-kamelets JAR filename 
in java.class.path and the runtime MXBean classpath. Launcher dependencies can 
instead be nested inside an executable JAR or loaded through the launcher's 
manifest Class-Path. Neither layout exposes the catalog filename in these 
classpath strings.

The helper then returns KameletCatalogHelper.KAMELETS_VERSION instead of 
detecting the catalog actually bundled with the launcher. The default version 
feeds run, export, init, catalog commands, dependency listing and other 
consumers of the shared helper.

In the standard Apache distribution, the bundled and fallback versions are 
currently aligned, so this does not imply a version change for normal Apache 
users. The gap becomes visible when the bundled catalog differs from the 
build-time fallback, or when a catalog JAR is renamed.

Reproduction: load the helper with an isolated classloader that also contains a 
renamed catalog JAR. Put a version different from the fallback in 
META-INF/maven/org.apache.camel.kamelets/camel-kamelets/pom.properties. 
extractKameletsVersion() returns the fallback instead of the metadata version.

Expected: preserve existing filename detection, then read the bundled catalog 
Maven metadata before using the build-time fallback. If metadata cannot be 
read, log the IOException at debug level and keep the existing fallback. 
Explicit version selection remains supported.

The fix includes regression coverage for metadata detection, SNAPSHOT versions, 
missing metadata, missing or empty version values, and unreadable metadata.

Pull request: https://github.com/apache/camel/pull/30221




--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to