You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@camel.apache.org by "Claus Ibsen (Jira)" <ji...@apache.org> on 2026/04/16 10:18:00 UTC
[jira] [Updated] (CAMEL-23335) Lazy-load JBang plugins only when the command actually needs them
[ https://issues.apache.org/jira/browse/CAMEL-23335?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Claus Ibsen updated CAMEL-23335:
--------------------------------
Fix Version/s: 4.x
> Lazy-load JBang plugins only when the command actually needs them
> -----------------------------------------------------------------
>
> Key: CAMEL-23335
> URL: https://issues.apache.org/jira/browse/CAMEL-23335
> Project: Camel
> Issue Type: Improvement
> Components: camel-jbang
> Affects Versions: 4.19.0
> Reporter: Federico Mariani
> Priority: Major
> Fix For: 4.x
>
>
> Currently, _PluginHelper.addPlugins()_ calls _getActivePlugins()_ which downloads and instantiates all configured plugins on every CLI invocation, regardless of whether the target command needs them. This adds unnecessary overhead for built-in commands that don't interact with plugins (e.g., camel get, camel version, camel ps).
> Plugins interact with the CLI in two distinct ways:
> 1. *Direct invocation* — the plugin registers its own top-level command via _Plugin.customize()_ (e.g., _camel forage run_). The plugin is only needed when target matches the plugin's command name.
> 2. *Indirect contribution* — the plugin provides a _PluginRunCustomizer_ and/or _PluginExporter_ that hook into camel run and camel export. For example, the forage plugin's _PluginRunCustomizer.beforeRun()_ resolves config directories, and its _PluginExporter.getDependencies()_ contributes runtime dependencies. These are invoked inside _Run.java_ and _ExportBaseCommand.java_ via a second call to _getActivePlugins()_.
> The optimization would be:
> - In _addPlugins()_: skip _getActivePlugins()_ entirely when target is a known built-in command that doesn't use plugins (e.g., get, version, ps, trace, top, log, etc.). Only download plugins when target matches a plugin command, or when target is a command that uses the Plugin SPI (run, export, cmd, script, transform).
> - In _Run.java_ / _ExportBaseCommand.java_: the existing _getActivePlugins()_ calls remain, as they are needed for PluginRunCustomizer and PluginExporter. These are already gated by --skip-plugins.
> This would make commands like camel get or camel version completely unaffected by installed plugins
--
This message was sent by Atlassian Jira
(v8.20.10#820010)