Luigi De Masi created CAMEL-24799:
-------------------------------------

             Summary:  camel-jbang: Installing Camel Kit by command name loses 
the requested plugin version
                 Key: CAMEL-24799
                 URL: https://issues.apache.org/jira/browse/CAMEL-24799
             Project: Camel
          Issue Type: Bug
          Components: camel-jbang
    Affects Versions: 4.22.0
            Reporter: Luigi De Masi
            Assignee: Luigi De Masi


Installing Camel Kit using its command name accepts {{{}--version{}}}, but 
saves an incomplete plugin registration. Loading the plugin then attempts to 
resolve an artifact
using the default Apache Camel group and the running Camel version.

The Camel shell also suggests {{{}plugin add kit{}}}, making this an advertised 
installation path.
h3. Steps to reproduce

Using Camel JBang 4.22.0:
{code:bash}
  camel plugin add kit --version=0.4.0
  camel kit --help
  {code}
h3. Actual result

The saved {{kit}} entry contains {{"firstVersion": "0.4.0"}} but no 
{{{}dependency{}}}. Loading attempts to resolve:
{code:java}
  org.apache.camel:camel-jbang-plugin-kit:4.22.0
  {code}
This fails because those coordinates do not exist.
h3. Expected result

The registration should preserve the requested plugin version and resolve:
{code:java}
  io.github.luigidemasi:camel-jbang-plugin-kit:0.4.0
  {code}
h3. Investigation

The [bundled 
registry|https://github.com/apache/camel/blob/camel-4.22.0/dsl/camel-jbang/camel-jbang-core/src/main/resources/known-plugins.json]
 defines {{"name": "camel-
kit"}} and {{{}"command": "kit"{}}}, but {{findKnownPlugin()}} matches only 
{{{}name{}}}.

Consequently, {{kit}} is treated as an unknown plugin. Its {{artifactId}} 
remains unset, so {{PluginAdd}} does not construct or persist dependency 
coordinates. Plugin
loading subsequently falls back to {{org.apache.camel}} and the running Camel 
version.

The registry also contains an incorrect artifact ID, 
{{{}camel-kit-jbang-plugin{}}}, which should be {{{}camel-jbang-plugin-kit{}}}. 
This is a separate metadata inconsistency,
not the direct cause of the failed name lookup.
h3. Suggested fix
 * Recognize {{kit}} while preserving support for the existing {{camel-kit}} 
name.
 * Correct the registry's artifact ID.
 * Add regression coverage verifying that registration persists the correct GAV 
and honors {{{}--version{}}}.

h3. Workaround
{code:bash}
  camel plugin add kit \
    --gav=io.github.luigidemasi:camel-jbang-plugin-kit:0.4.0 \
    --description="Design Apache Camel Integrations with AI"{code}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to