Federico Mariani created CAMEL-23157:
----------------------------------------

             Summary: Camel JBang Run command should call Plugin exporter 
dependencies like Export does
                 Key: CAMEL-23157
                 URL: https://issues.apache.org/jira/browse/CAMEL-23157
             Project: Camel
          Issue Type: Improvement
          Components: camel-jbang
    Affects Versions: 4.18.0
            Reporter: Federico Mariani


The ExportBaseCommand already calls Plugin.getExporter().getDependencies() on 
all active plugins to resolve additional dependencies during camel export. 
However, the Run command does not have an equivalent hook, meaning plugins 
cannot contribute dependencies to camel run.

This forces plugins to register custom subcommands (e.g., camel <plugin-name> 
run) with an overridden addDependencies() method, instead of transparently 
augmenting the standard camel run command.

The Run.java class should call PluginExporter.getDependencies() from active 
plugins, consistent with how ExportBaseCommand already does it (lines 593-603):

  if (!skipPlugins) {
      Set<PluginExporter> exporters = PluginHelper.getActivePlugins(getMain(), 
repositories).values()
              .stream()
              .map(Plugin::getExporter)
              .filter(Optional::isPresent)
              .map(Optional::get)
              .collect(Collectors.toSet());

      for (PluginExporter exporter : exporters) {
          dependencies.addAll(exporter.getDependencies(runtime));
      }
  }

This would allow any installed JBang plugin to transparently contribute 
dependencies to camel run without requiring a custom run subcommand.



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

Reply via email to