Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

KnownDependenciesResolver to support packages #17035

Merged
merged 2 commits into from
Feb 5, 2025

Conversation

bartoszpop
Copy link
Contributor

This pull request enhances KnownDependenciesResolver to match the well known dependencies against packages up to the root package, so that a single entry in the camel-main-known-dependencies.properties file is sufficient to load any class from this jar, instead of having a separate entry for each class.

This is a cherry-pick from #17034

@davsclaus
Copy link
Contributor

what is the reason for this, this file is maintained by camel project and not be end users. It is an implementation detail.

@davsclaus
Copy link
Contributor

okay do you have an example of a real world situation this was beneficial - just want to understand better.

@bartoszpop
Copy link
Contributor Author

Hi @davsclaus, thank you for your feedback. We utilize this mechanism to inject predefined bean and AggregationStrategy classes to JBang runtime, meaning that we pass the parameter --dep=com.example:custom-catalog:1.0.0 and is contains camel-main-known-dependencies.properties with a list of custom classes pointing to custom jars, e.g.

org.example.some.BeanClass=com.example:some-jar:1.0.0
org.example.some.AggregationStrategyClass=com.example:some-jar:1.0.0
org.example.other.BeanClass=com.example:other-jar:1.0.0

Instead of having separate entries for each class it would be reasonable to have them merged, because all classes in the same jar will share the same package, e.g.

org.example.some=com.example:some-jar:1.0.0
org.example.other=com.example:other-jar:1.0.0

@davsclaus davsclaus force-pushed the package-scoped-deps-main branch from e61f438 to 7fbf7f0 Compare February 5, 2025 06:31
@davsclaus
Copy link
Contributor

modified:   dsl/camel-kamelet-main/src/test/java/org/apache/camel/main/download/KnownDependenciesResolverTest.java

@davsclaus
Copy link
Contributor

can you update this file as its auto formatted as your code style is not standard camel

@davsclaus
Copy link
Contributor

okay i can rebuild afterwards to update the file

@davsclaus davsclaus merged commit e8365c9 into apache:main Feb 5, 2025
2 of 4 checks passed
@bartoszpop
Copy link
Contributor Author

Thank you @davsclaus

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants