davsclaus opened a new pull request, #26594: URL: https://github.com/apache/camel/pull/26594
A new shared authoring tool, `camel_dependency_for_class` (camel-jbang-core, wrapped in camel-jbang-mcp), answers the question a bean of a third-party type raises: which dependency provides this class, and how do I declare it. Local first, online last, and the answer names the source that produced it: 1. **Known dependencies**: the three mapping files of camel-kamelet-main that `camel run` downloads on demand, matched by the class and then each enclosing package (the lookup the validator uses since #26574, with the generated third-party list of #26575). A hit also means `camel run` needs no declaration. 2. **Camel component, data format or language**: the `camel-` artifact for each runtime: `camel-<name>` with `camel-bom` on Camel Main, `camel-<name>-starter` with `camel-spring-boot-bom` on Spring Boot, `camel-quarkus-<name>` with `camel-quarkus-bom` on Quarkus. A third-party library has the same coordinates in every runtime. 3. **Maven Central**, only with `mavenCentral=true`: the class search. The publisher's group id is almost always a prefix of the package, so the search is first narrowed to each package prefix as the group and only then run unqualified (the unqualified search for `org.apache.commons.text.StringSubstitutor` has 20,737 hits and its first page holds only repackaged copies). Within the hits the artifact whose name is in the package wins and shaded or uber jars lose. The version comes from the artifact's date-ordered version list (`core=gav`): the newest release, skipping pre-releases (okhttp 4.12.0, not 5.0.0-alpha.16); never `LATEST`. The answer is marked as a guess with the candidate artifacts listed. The JDK `HttpClient` with the JVM proxy settings is used, as the CLI's other HTTP calls do. Central throttles repeated queries by holding a request for about thirty seconds, so the timeout is 40 s, there is no retry, and answers are cached per class. The answer carries `camel.jbang.dependencies`, `--dep`, and the `pom.xml` dependency for the three runtimes (or one with `runtime=main|spring-boot|quarkus`), the source, and whether `camel run` downloads it by itself. Tests: five for the three sources with Central mocked, the shared-registry test, and the MCP wrapper test. Documented in the MCP page's tool table and examples and in the running page's advanced section. Verified through a running MCP server for Postgres, Hikari, Caffeine, a Kafka component with all three runtime forms, an unknown class, and okhttp via Central. The second commit carries the two notes left on #26574: the lazy initialiser of the mapping states its benign-race intent, and a test shows that a class loader without the mapping files answers nothing. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01Bp3538HRBPMQkb5ta9xRaj -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
