CAMEL-23334: Fix lazy plugin loading to skip unnecessary Maven resolution#23003
Conversation
…tion PluginHelper.addPlugins() was downloading ALL configured plugins before filtering by the target command. This caused expensive Maven resolution (e.g. 3.7s for 453 transitive dependencies) on every CLI invocation, even for commands like "camel version" that don't use any plugin. Move the command-name filter into getActivePlugins() so it runs before getPlugin()/downloadPlugin(), skipping resolution entirely for plugins that don't match the current command.
|
🌟 Thank you for your contribution to the Apache Camel project! 🌟 🐫 Apache Camel Committers, please review the following items:
|
|
and jbang itself may eventually also become faster, and because camel jbang has a lot of commands and options then this will be good for us as well: jbangdev/jbang#2453 |
|
🧪 CI tested the following changed modules:
💡 Manual integration tests recommended:
All tested modules (6 modules)
|
nice! |
Summary
PluginHelper.addPlugins()which was downloading ALL configured plugins before filtering by the target command, causing expensive Maven resolution on every CLI invocation — even for commands likecamel versionthat don't use any plugin.getActivePlugins()so it runs beforegetPlugin()/downloadPlugin(), skipping resolution entirely for plugins that don't match the current command.getActivePluginsoverloads.Before:
camel versionwith a third-party plugin (453 transitive deps) → ~3.7s wasted on Maven resolutionAfter:
camel version→ zero Maven resolution, instantTest plan
mvn verifyincamel-jbang-core— 379 tests, 0 failures)camel versionwith forage plugin installed produces no resolution messagescamel foragestill resolves the forage plugin correctlycamel pluginlists all configured plugins