Claus Ibsen created CAMEL-24809:
-----------------------------------

             Summary: camel-kamelet-main - map more third-party libraries in 
the known dependencies, by package, and generate the list from the managed 
dependencies
                 Key: CAMEL-24809
                 URL: https://issues.apache.org/jira/browse/CAMEL-24809
             Project: Camel
          Issue Type: Improvement
          Components: camel-kamelet-main
            Reporter: Claus Ibsen


camel run resolves a class in a bean declaration or in application.properties 
to a Maven dependency through {{camel-main-known-dependencies.properties}} (65 
entries today) and downloads it on demand. The mapping is hand-maintained and 
covers a handful of JDBC drivers, connection factories and LangChain4j 
providers, so a bean of any other third-party type fails at startup with a 
class-not-found unless the dependency is declared by hand.

{{KnownDependenciesResolver.findGav}} matches the class name and then each 
enclosing package, so one line per library is enough: {{org.postgresql = 
org.postgresql:postgresql:${pgjdbc-driver-version}}} covers the Driver, 
PGSimpleDataSource, the pooling datasource and everything else in the jar.

h3. Proposal

# Map the libraries camel-parent already manages a version for, by their 
distinctive package (never a shared parent such as {{org.apache.commons}}): 
JDBC ({{org.h2}}, {{org.mariadb.jdbc}}, {{com.mchange.v2.c3p0}}, 
{{com.zaxxer.hikari}}, the datasource classes of the MySQL, MSSQL and Oracle 
drivers listed by driver only today), messaging 
({{org.apache.activemq.ActiveMQConnectionFactory}} for classic ActiveMQ, 
{{org.apache.kafka.clients}}), data ({{com.fasterxml.jackson.databind}}, 
{{com.google.gson}}, {{org.yaml.snakeyaml}}, {{org.apache.commons.csv}}, 
{{com.univocity.parsers}}, {{org.apache.commons.lang3}}, 
{{org.apache.commons.io}}, {{com.google.common}}), templates and HTTP 
({{freemarker.template}}, {{org.apache.velocity}}, {{org.apache.hc.client5}}), 
caching ({{com.github.benmanes.caffeine}}, {{com.hazelcast}}, 
{{org.infinispan}}, {{org.ehcache}}), cloud SDKs by service package 
({{software.amazon.awssdk.services.s3}} to {{software.amazon.awssdk:s3}} and 
the same for sqs, sns, dynamodb, kinesis), observability ({{io.micrometer}}, 
{{io.opentelemetry.api}}), scripting ({{groovy.lang}} to 
{{org.apache.groovy:groovy}}).
# Better than maintaining that list by hand: generate it at build time. For 
each third-party artifact camel-parent manages, open the jar and emit its 
distinctive top-level packages against the GAV into a 
{{camel-thirdparty-known-dependencies.properties}} next to the two existing 
files, loaded by {{KnownDependenciesResolver.loadKnownDependencies}}.

The validator in camel-jbang reads the same files (PR #26574), so every entry 
added here also stops a false "class not found" in camel validate and the MCP 
write tool.



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

Reply via email to