[
https://issues.apache.org/jira/browse/CAMEL-26764?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Christoph Deppisch resolved CAMEL-26764.
----------------------------------------
Resolution: Fixed
> camel-jbang - Let plugins decide per-command whether to add customizations
> and dependencies
> -------------------------------------------------------------------------------------------
>
> Key: CAMEL-26764
> URL: https://issues.apache.org/jira/browse/CAMEL-26764
> Project: Camel
> Issue Type: Improvement
> Components: camel-jbang
> Reporter: Christoph Deppisch
> Assignee: Christoph Deppisch
> Priority: Major
>
> Currently, all configured active Camel JBang plugins add their customizations
> (subcommands, dependencies, exporters) whenever any command is executed. The
> {{Plugin.customize(CommandLine, CamelJBangMain)}} method receives no
> information about which command is actually being run, and
> {{PluginExporter}}/{{PluginRunCustomizer}} are applied during {{run}} and
> {{export}} regardless of whether the plugin is relevant to that invocation.
> This causes problems when a plugin is configured with a version that differs
> from the core (e.g. a SNAPSHOT version) — the plugin's dependency resolution
> can fail and break unrelated commands that don't need the plugin at all.
> The proposal is to let each plugin decide, based on the command being
> executed, whether it should add its customizations and dependencies. The
> rules would be:
> * {{camel help}} — all plugins customize (so help text shows all available
> subcommands)
> * {{camel <plugin-command> ...}} (e.g. {{camel test run}}) — the plugin
> customizes because it owns the command
> * {{camel run}} — only plugins that have a {{PluginRunCustomizer}} or
> explicitly opt in should customize; a test plugin adding itself to a plain
> {{camel run}} does not make sense
> * {{camel export}} — plugins that provide a {{PluginExporter}} should
> customize, since they participate in the export process
> * Other built-in commands (e.g. {{camel ps}}, {{camel get}}) — plugins that
> don't contribute to these commands should stay out
> This way, the set of active plugins for any given command represents the
> required minimum rather than the full static configuration.
> A possible approach is to extend the {{Plugin}} interface with a method like
> {{boolean appliesTo(String command)}} or pass the target command into
> {{customize()}}, so each plugin can make an informed decision.
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)