[ 
https://issues.apache.org/jira/browse/CAMEL-24810?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18116720#comment-18116720
 ] 

Claus Ibsen commented on CAMEL-24810:
-------------------------------------

Scope note (2026-09-18): the pom.xml form of the answer covers all three 
runtimes, not only Spring Boot and Quarkus:

* *Camel Main*: a plain dependency; for a Camel component 
{{org.apache.camel:camel-<name>}} with {{camel-bom}} for the version.
* *Spring Boot*: {{org.apache.camel.springboot:camel-<name>-starter}} with 
{{camel-spring-boot-bom}}.
* *Quarkus*: {{org.apache.camel.quarkus:camel-quarkus-<name>}} with 
{{camel-quarkus-bom}}.

For a third-party library the coordinates are the same in every runtime; only 
Camel components differ per runtime. The tool takes an optional {{runtime}} 
argument (main, spring-boot, quarkus) or returns all three forms, plus 
{{camel.jbang.dependencies}} and {{--dep}} for camel run. The answer should 
also say which lookup step produced it (known dependencies, component mapping, 
or Maven Central) so a Central guess is not pasted into a pom unchecked.

Since CAMEL-24809 the first step can call {{KnownDependenciesResolver}} 
directly (camel-kamelet-main is on the MCP server's classpath) and returns 
resolved versions from the generated third-party file.

> camel-jbang-mcp - tool that maps a class or package name to its Maven 
> dependency, known dependencies first then Maven Central
> -----------------------------------------------------------------------------------------------------------------------------
>
>                 Key: CAMEL-24810
>                 URL: https://issues.apache.org/jira/browse/CAMEL-24810
>             Project: Camel
>          Issue Type: New Feature
>          Components: camel-jbang-mcp
>            Reporter: Claus Ibsen
>            Priority: Major
>
> When an AI assistant or a person writes a bean of a third-party type, such as 
> a datasource or a connection factory, the question "which Maven dependency 
> provides this class" has no tool answer today. With camel run the 
> known-dependencies mapping downloads many of them on demand, but on a Spring 
> Boot or Quarkus project nothing downloads on demand and the coordinates must 
> go into the pom.
> h3. Proposal
> A tool in camel-jbang-mcp, for example {{camel_dependency_for_class}}, that 
> takes a class or package name and answers with the Maven GAV and how to 
> declare it. Lookup order:
> # The known-dependencies files camel-kamelet-main ships 
> ({{camel-main-known-dependencies.properties}}, 
> {{camel-component-known-dependencies.properties}}, 
> {{camel-factoryfinder-known-dependencies.properties}}), matched the way the 
> runtime matches (class, then each enclosing package). A hit also says that 
> camel run downloads it automatically.
> # The Camel component mapping, so a class in 
> {{org.apache.camel.component.kafka}} answers {{org.apache.camel:camel-kafka}} 
> with the running Camel version.
> # Fallback: Maven Central's class search 
> ({{search.maven.org/solrsearch/select?q=fc:"<class>"}}). It answers in well 
> under a second but returns one document per version and shaded copy, oldest 
> first (8,233 hits for {{com.zaxxer.hikari.HikariDataSource}}), so the tool 
> must group by group and artifact, prefer the artifact whose name matches the 
> package, and fetch the latest version with a second query. Needs a timeout 
> and a cache; the tool must degrade to "unknown, declare it yourself" without 
> network.
> The answer carries the three declaration forms: 
> {{camel.jbang.dependencies=...}} in application.properties, {{--dep}} on 
> camel run, and a pom.xml snippet for Spring Boot and Quarkus projects. The 
> offline part of the lookup is what the validator in camel-jbang-core already 
> does (PR #26574); the tool adds the online fallback and the declaration forms.



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

Reply via email to