Thomas Raddatz created CAMEL-25497:
--------------------------------------
Summary: camel-jbang - camel run with --jvm-debug, --jvm-args or
--open-telemetry-agent starts the default Camel version of the jbang catalog
Key: CAMEL-25497
URL: https://issues.apache.org/jira/browse/CAMEL-25497
Project: Camel
Issue Type: Bug
Components: camel-jbang
Affects Versions: 4.22.1
Reporter: Thomas Raddatz
With {{\-\-jvm-debug}}, {{\-\-jvm-args}} or {{\-\-open-telemetry-agent}},
{{camel run}} starts the integration in a new JVM with {{jbang run ...
camel@apache/camel run ...}} ({{Run.runCamelVersion}}). It hands
{{\-Dcamel.jbang.version}} to that JVM only when {{\-\-camel-version}} is given
and differs from the running version. Otherwise the new JVM runs the default
version of the {{camel@apache/camel}} catalog script ({{CamelJBang.java}},
currently 4.22.0), not the version the user started.
A Camel CLI pinned with {{jbang \-Dcamel.jbang.version=4.22.1}}, or started
with a {{\-\-camel-version}} equal to the running version (it is reset as "same
version"), therefore runs the integration on 4.22.0. With the Camel JBang test
plugin installed, the new JVM fails at start-up (see below); otherwise it runs
the other Camel version without a warning.
h3. Reproduction (Camel CLI 4.22.1)
{code:bash}
jbang -Dcamel.jbang.version=4.22.1 camel@apache/camel init hello.camel.yaml
jbang -Dcamel.jbang.version=4.22.1 camel@apache/camel run hello.camel.yaml
--jvm-args=-Dfoo=bar --max-seconds=10 --verbose
{code}
The command line printed for the new JVM has no {{\-Dcamel.jbang.version}}:
{noformat}
jbang run --java-options=-Dfoo=bar --java=21 camel@apache/camel run
hello.camel.yaml --max-seconds=10 --verbose --kamelets-version=4.22.0
{noformat}
With the Camel JBang test plugin installed, the new JVM then resolves the
plugin in 4.22.0 and fails:
{noformat}
Artifact org.apache.camel:camel-jbang-plugin-test:pom:4.22.0 is present in the
local repository, ...
Exception in thread "main" java.lang.NoClassDefFoundError:
org/citrusframework/jbang/cli/Printer
{noformat}
The same {{camel run}} without these options starts Apache Camel 4.22.1.
{{\-\-jvm-debug=5005}} builds the same command line with {{\-\-debug=5005}}.
Expected: the new JVM runs the Camel version of the CLI that starts it, unless
{{\-\-camel-version}} asks for another one.
The {{camelVersion != null}} guard dates from CAMEL-19726, which added the JVM
debug relaunch to the code path that until then served {{\-\-camel-version}}
only.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)