This is an automated email from the ASF dual-hosted git repository.

davsclaus pushed a commit to branch jb
in repository https://gitbox.apache.org/repos/asf/camel.git

commit 1cb347d50713384c45535c3d866e69522eba4853
Author: Claus Ibsen <[email protected]>
AuthorDate: Sat Mar 7 14:33:06 2026 +0100

    CAMEL-23146: camel-launcher - Should install embedded plugins so they 
appear in --help
---
 .../dsl/jbang/core/commands/CamelJBangMain.java    | 286 ++++++++++++---------
 dsl/camel-jbang/camel-launcher/pom.xml             |   6 +-
 .../camel/dsl/jbang/launcher/CamelLauncher.java    |   6 +-
 .../dsl/jbang/launcher/CamelLauncherMain.java      |  38 +++
 .../dsl/jbang/launcher/CamelLauncherTest.java      |  39 ++-
 .../camel-launcher/src/test/resources/bad.yaml     |  26 ++
 6 files changed, 269 insertions(+), 132 deletions(-)

diff --git 
a/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/CamelJBangMain.java
 
b/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/CamelJBangMain.java
index 8a55de137ba1..93861612e5f4 100644
--- 
a/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/CamelJBangMain.java
+++ 
b/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/CamelJBangMain.java
@@ -68,11 +68,17 @@ public class CamelJBangMain implements Callable<Integer> {
 
     private Printer out = new Printer.SystemOutPrinter();
 
+    private boolean discoverPlugins = true;
+
     public static void run(String... args) {
         run(new CamelJBangMain(), args);
     }
 
     public static void run(CamelJBangMain main, String... args) {
+        main.execute(args);
+    }
+
+    public void execute(String... args) {
         // set pid as system property as logging ${sys:pid} needs to be 
resolved on windows
         try {
             long pid = ProcessHandle.current().pid();
@@ -81,128 +87,132 @@ public class CamelJBangMain implements Callable<Integer> {
             // ignore
         }
 
-        commandLine = new CommandLine(main)
-                .addSubcommand("bind", new CommandLine(new Bind(main)))
-                .addSubcommand("catalog", new CommandLine(new 
CatalogCommand(main))
-                        .addSubcommand("component", new CommandLine(new 
CatalogComponent(main)))
-                        .addSubcommand("dataformat", new CommandLine(new 
CatalogDataFormat(main)))
-                        .addSubcommand("dev-console", new CommandLine(new 
CatalogDevConsole(main)))
-                        .addSubcommand("kamelet", new CommandLine(new 
CatalogKamelet(main)))
-                        .addSubcommand("transformer", new CommandLine(new 
CatalogTransformer(main)))
-                        .addSubcommand("language", new CommandLine(new 
CatalogLanguage(main)))
-                        .addSubcommand("other", new CommandLine(new 
CatalogOther(main))))
-                .addSubcommand("cmd", new CommandLine(new CamelAction(main))
-                        .addSubcommand("browse", new CommandLine(new 
CamelBrowseAction(main)))
-                        .addSubcommand("disable-processor", new 
CommandLine(new CamelProcessorDisableAction(main)))
-                        .addSubcommand("enable-processor", new CommandLine(new 
CamelProcessorEnableAction(main)))
-                        .addSubcommand("gc", new CommandLine(new 
CamelGCAction(main)))
-                        .addSubcommand("load", new CommandLine(new 
CamelLoadAction(main)))
-                        .addSubcommand("logger", new CommandLine(new 
LoggerAction(main)))
-                        .addSubcommand("receive", new CommandLine(new 
CamelReceiveAction(main)))
-                        .addSubcommand("reload", new CommandLine(new 
CamelReloadAction(main)))
-                        .addSubcommand("reset-stats", new CommandLine(new 
CamelResetStatsAction(main)))
-                        .addSubcommand("resume-route", new CommandLine(new 
CamelRouteResumeAction(main)))
-                        .addSubcommand("route-structure", new CommandLine(new 
CamelRouteStructureAction(main)))
-                        .addSubcommand("send", new CommandLine(new 
CamelSendAction(main)))
-                        .addSubcommand("start-group", new CommandLine(new 
CamelRouteGroupStartAction(main)))
-                        .addSubcommand("start-route", new CommandLine(new 
CamelRouteStartAction(main)))
-                        .addSubcommand("stop-group", new CommandLine(new 
CamelRouteGroupStopAction(main)))
-                        .addSubcommand("stop-route", new CommandLine(new 
CamelRouteStopAction(main)))
-                        .addSubcommand("stub", new CommandLine(new 
CamelStubAction(main)))
-                        .addSubcommand("suspend-route", new CommandLine(new 
CamelRouteSuspendAction(main)))
-                        .addSubcommand("thread-dump", new CommandLine(new 
CamelThreadDump(main))))
-                .addSubcommand("config", new CommandLine(new 
ConfigCommand(main))
-                        .addSubcommand("get", new CommandLine(new 
ConfigGet(main)))
-                        .addSubcommand("list", new CommandLine(new 
ConfigList(main)))
-                        .addSubcommand("set", new CommandLine(new 
ConfigSet(main)))
-                        .addSubcommand("unset", new CommandLine(new 
ConfigUnset(main))))
-                .addSubcommand("completion", new CommandLine(new 
Complete(main)))
-                .addSubcommand("doc", new CommandLine(new CatalogDoc(main)))
-                .addSubcommand("debug", new CommandLine(new Debug(main)))
-                .addSubcommand("dependency", new CommandLine(new 
DependencyCommand(main))
-                        .addSubcommand("copy", new CommandLine(new 
DependencyCopy(main)))
-                        .addSubcommand("list", new CommandLine(new 
DependencyList(main)))
-                        .addSubcommand("runtime", new CommandLine(new 
DependencyRuntime(main)))
-                        .addSubcommand("update", new CommandLine(new 
DependencyUpdate(main))))
-                .addSubcommand("dirty", new CommandLine(new Dirty(main)))
-                .addSubcommand("eval", new CommandLine(new EvalCommand(main))
-                        .addSubcommand("expression", new CommandLine(new 
EvalExpressionCommand(main))))
-                .addSubcommand("export", new CommandLine(new Export(main)))
-                .addSubcommand("explain", new CommandLine(new Explain(main)))
-                .addSubcommand("harden", new CommandLine(new Harden(main)))
-                .addSubcommand("get", new CommandLine(new CamelStatus(main))
-                        .addSubcommand("bean", new CommandLine(new 
CamelBeanDump(main)))
-                        .addSubcommand("blocked", new CommandLine(new 
ListBlocked(main)))
-                        .addSubcommand("circuit-breaker", new CommandLine(new 
ListCircuitBreaker(main)))
-                        .addSubcommand("consumer", new CommandLine(new 
ListConsumer(main)))
-                        .addSubcommand("context", new CommandLine(new 
CamelContextStatus(main)))
-                        .addSubcommand("count", new CommandLine(new 
CamelCount(main)))
-                        .addSubcommand("endpoint", new CommandLine(new 
ListEndpoint(main)))
-                        .addSubcommand("event", new CommandLine(new 
ListEvent(main)))
-                        .addSubcommand("groovy", new CommandLine(new 
ListGroovy(main)))
-                        .addSubcommand("group", new CommandLine(new 
CamelRouteGroupStatus(main)))
-                        .addSubcommand("health", new CommandLine(new 
ListHealth(main)))
-                        .addSubcommand("history", new CommandLine(new 
CamelHistoryAction(main)))
-                        .addSubcommand("inflight", new CommandLine(new 
ListInflight(main)))
-                        .addSubcommand("internal-task", new CommandLine(new 
ListInternalTask(main)))
-                        .addSubcommand("kafka", new CommandLine(new 
ListKafka(main)))
-                        .addSubcommand("metric", new CommandLine(new 
ListMetric(main)))
-                        .addSubcommand("platform-http", new CommandLine(new 
ListPlatformHttp(main)))
-                        .addSubcommand("processor", new CommandLine(new 
CamelProcessorStatus(main)))
-                        .addSubcommand("producer", new CommandLine(new 
ListProducer(main)))
-                        .addSubcommand("properties", new CommandLine(new 
ListProperties(main)))
-                        .addSubcommand("rest", new CommandLine(new 
ListRest(main)))
-                        .addSubcommand("route", new CommandLine(new 
CamelRouteStatus(main)))
-                        .addSubcommand("route-controller", new CommandLine(new 
RouteControllerAction(main)))
-                        .addSubcommand("route-dump", new CommandLine(new 
CamelRouteDumpAction(main)))
-                        .addSubcommand("service", new CommandLine(new 
ListService(main)))
-                        .addSubcommand("source", new CommandLine(new 
CamelSourceAction(main)))
-                        .addSubcommand("startup-recorder", new CommandLine(new 
CamelStartupRecorderAction(main)))
-                        .addSubcommand("transformer", new CommandLine(new 
ListTransformer(main)))
-                        .addSubcommand("variable", new CommandLine(new 
ListVariable(main)))
-                        .addSubcommand("vault", new CommandLine(new 
ListVault(main))))
-                .addSubcommand("hawtio", new CommandLine(new Hawtio(main)))
-                .addSubcommand("infra", new CommandLine(new InfraCommand(main))
-                        .addSubcommand("get", new CommandLine(new 
InfraGet(main)))
-                        .addSubcommand("list", new CommandLine(new 
InfraList(main)))
-                        .addSubcommand("log", new CommandLine(new 
InfraLog(main)))
-                        .addSubcommand("ps", new CommandLine(new 
InfraPs(main)))
-                        .addSubcommand("run", new CommandLine(new 
InfraRun(main)))
-                        .addSubcommand("stop", new CommandLine(new 
InfraStop(main))))
-                .addSubcommand("init", new CommandLine(new Init(main)))
-                .addSubcommand("jolokia", new CommandLine(new Jolokia(main)))
-                .addSubcommand("log", new CommandLine(new 
CamelLogAction(main)))
-                .addSubcommand("nano", new CommandLine(new Nano(main)))
-                .addSubcommand("plugin", new CommandLine(new 
PluginCommand(main))
-                        .addSubcommand("add", new CommandLine(new 
PluginAdd(main)))
-                        .addSubcommand("delete", new CommandLine(new 
PluginDelete(main)))
-                        .addSubcommand("get", new CommandLine(new 
PluginGet(main))))
-                .addSubcommand("ps", new CommandLine(new ListProcess(main)))
-                .addSubcommand("run", new CommandLine(new Run(main)))
-                .addSubcommand("sbom", new CommandLine(new 
SBOMGenerator(main)))
-                .addSubcommand("script", new CommandLine(new Script(main)))
-                .addSubcommand("shell", new CommandLine(new Shell(main)))
-                .addSubcommand("stop", new CommandLine(new StopProcess(main)))
-                .addSubcommand("top", new CommandLine(new CamelTop(main))
-                        .addSubcommand("context", new CommandLine(new 
CamelContextTop(main)))
-                        .addSubcommand("group", new CommandLine(new 
CamelRouteGroupTop(main)))
-                        .addSubcommand("processor", new CommandLine(new 
CamelProcessorTop(main)))
-                        .addSubcommand("route", new CommandLine(new 
CamelRouteTop(main)))
-                        .addSubcommand("source", new CommandLine(new 
CamelSourceTop(main))))
-                .addSubcommand("trace", new CommandLine(new 
CamelTraceAction(main)))
-                .addSubcommand("transform", new CommandLine(new 
TransformCommand(main))
-                        .addSubcommand("message", new CommandLine(new 
TransformMessageAction(main)))
-                        .addSubcommand("route", new CommandLine(new 
TransformRoute(main))))
-                .addSubcommand("update", new CommandLine(new 
UpdateCommand(main))
-                        .addSubcommand("list", new CommandLine(new 
UpdateList(main)))
-                        .addSubcommand("run", new CommandLine(new 
UpdateRun(main))))
-                .addSubcommand("version", new CommandLine(new 
VersionCommand(main))
-                        .addSubcommand("get", new CommandLine(new 
VersionGet(main)))
-                        .addSubcommand("list", new CommandLine(new 
VersionList(main)))
-                        .addSubcommand("set", new CommandLine(new 
VersionSet(main))))
+        commandLine = new CommandLine(this)
+                .addSubcommand("bind", new CommandLine(new Bind(this)))
+                .addSubcommand("catalog", new CommandLine(new 
CatalogCommand(this))
+                        .addSubcommand("component", new CommandLine(new 
CatalogComponent(this)))
+                        .addSubcommand("dataformat", new CommandLine(new 
CatalogDataFormat(this)))
+                        .addSubcommand("dev-console", new CommandLine(new 
CatalogDevConsole(this)))
+                        .addSubcommand("kamelet", new CommandLine(new 
CatalogKamelet(this)))
+                        .addSubcommand("transformer", new CommandLine(new 
CatalogTransformer(this)))
+                        .addSubcommand("language", new CommandLine(new 
CatalogLanguage(this)))
+                        .addSubcommand("other", new CommandLine(new 
CatalogOther(this))))
+                .addSubcommand("cmd", new CommandLine(new CamelAction(this))
+                        .addSubcommand("browse", new CommandLine(new 
CamelBrowseAction(this)))
+                        .addSubcommand("disable-processor", new 
CommandLine(new CamelProcessorDisableAction(this)))
+                        .addSubcommand("enable-processor", new CommandLine(new 
CamelProcessorEnableAction(this)))
+                        .addSubcommand("gc", new CommandLine(new 
CamelGCAction(this)))
+                        .addSubcommand("load", new CommandLine(new 
CamelLoadAction(this)))
+                        .addSubcommand("logger", new CommandLine(new 
LoggerAction(this)))
+                        .addSubcommand("receive", new CommandLine(new 
CamelReceiveAction(this)))
+                        .addSubcommand("reload", new CommandLine(new 
CamelReloadAction(this)))
+                        .addSubcommand("reset-stats", new CommandLine(new 
CamelResetStatsAction(this)))
+                        .addSubcommand("resume-route", new CommandLine(new 
CamelRouteResumeAction(this)))
+                        .addSubcommand("route-structure", new CommandLine(new 
CamelRouteStructureAction(this)))
+                        .addSubcommand("send", new CommandLine(new 
CamelSendAction(this)))
+                        .addSubcommand("start-group", new CommandLine(new 
CamelRouteGroupStartAction(this)))
+                        .addSubcommand("start-route", new CommandLine(new 
CamelRouteStartAction(this)))
+                        .addSubcommand("stop-group", new CommandLine(new 
CamelRouteGroupStopAction(this)))
+                        .addSubcommand("stop-route", new CommandLine(new 
CamelRouteStopAction(this)))
+                        .addSubcommand("stub", new CommandLine(new 
CamelStubAction(this)))
+                        .addSubcommand("suspend-route", new CommandLine(new 
CamelRouteSuspendAction(this)))
+                        .addSubcommand("thread-dump", new CommandLine(new 
CamelThreadDump(this))))
+                .addSubcommand("config", new CommandLine(new 
ConfigCommand(this))
+                        .addSubcommand("get", new CommandLine(new 
ConfigGet(this)))
+                        .addSubcommand("list", new CommandLine(new 
ConfigList(this)))
+                        .addSubcommand("set", new CommandLine(new 
ConfigSet(this)))
+                        .addSubcommand("unset", new CommandLine(new 
ConfigUnset(this))))
+                .addSubcommand("completion", new CommandLine(new 
Complete(this)))
+                .addSubcommand("doc", new CommandLine(new CatalogDoc(this)))
+                .addSubcommand("debug", new CommandLine(new Debug(this)))
+                .addSubcommand("dependency", new CommandLine(new 
DependencyCommand(this))
+                        .addSubcommand("copy", new CommandLine(new 
DependencyCopy(this)))
+                        .addSubcommand("list", new CommandLine(new 
DependencyList(this)))
+                        .addSubcommand("runtime", new CommandLine(new 
DependencyRuntime(this)))
+                        .addSubcommand("update", new CommandLine(new 
DependencyUpdate(this))))
+                .addSubcommand("dirty", new CommandLine(new Dirty(this)))
+                .addSubcommand("eval", new CommandLine(new EvalCommand(this))
+                        .addSubcommand("expression", new CommandLine(new 
EvalExpressionCommand(this))))
+                .addSubcommand("export", new CommandLine(new Export(this)))
+                .addSubcommand("explain", new CommandLine(new Explain(this)))
+                .addSubcommand("harden", new CommandLine(new Harden(this)))
+                .addSubcommand("get", new CommandLine(new CamelStatus(this))
+                        .addSubcommand("bean", new CommandLine(new 
CamelBeanDump(this)))
+                        .addSubcommand("blocked", new CommandLine(new 
ListBlocked(this)))
+                        .addSubcommand("circuit-breaker", new CommandLine(new 
ListCircuitBreaker(this)))
+                        .addSubcommand("consumer", new CommandLine(new 
ListConsumer(this)))
+                        .addSubcommand("context", new CommandLine(new 
CamelContextStatus(this)))
+                        .addSubcommand("count", new CommandLine(new 
CamelCount(this)))
+                        .addSubcommand("endpoint", new CommandLine(new 
ListEndpoint(this)))
+                        .addSubcommand("event", new CommandLine(new 
ListEvent(this)))
+                        .addSubcommand("groovy", new CommandLine(new 
ListGroovy(this)))
+                        .addSubcommand("group", new CommandLine(new 
CamelRouteGroupStatus(this)))
+                        .addSubcommand("health", new CommandLine(new 
ListHealth(this)))
+                        .addSubcommand("history", new CommandLine(new 
CamelHistoryAction(this)))
+                        .addSubcommand("inflight", new CommandLine(new 
ListInflight(this)))
+                        .addSubcommand("internal-task", new CommandLine(new 
ListInternalTask(this)))
+                        .addSubcommand("kafka", new CommandLine(new 
ListKafka(this)))
+                        .addSubcommand("metric", new CommandLine(new 
ListMetric(this)))
+                        .addSubcommand("platform-http", new CommandLine(new 
ListPlatformHttp(this)))
+                        .addSubcommand("processor", new CommandLine(new 
CamelProcessorStatus(this)))
+                        .addSubcommand("producer", new CommandLine(new 
ListProducer(this)))
+                        .addSubcommand("properties", new CommandLine(new 
ListProperties(this)))
+                        .addSubcommand("rest", new CommandLine(new 
ListRest(this)))
+                        .addSubcommand("route", new CommandLine(new 
CamelRouteStatus(this)))
+                        .addSubcommand("route-controller", new CommandLine(new 
RouteControllerAction(this)))
+                        .addSubcommand("route-dump", new CommandLine(new 
CamelRouteDumpAction(this)))
+                        .addSubcommand("service", new CommandLine(new 
ListService(this)))
+                        .addSubcommand("source", new CommandLine(new 
CamelSourceAction(this)))
+                        .addSubcommand("startup-recorder", new CommandLine(new 
CamelStartupRecorderAction(this)))
+                        .addSubcommand("transformer", new CommandLine(new 
ListTransformer(this)))
+                        .addSubcommand("variable", new CommandLine(new 
ListVariable(this)))
+                        .addSubcommand("vault", new CommandLine(new 
ListVault(this))))
+                .addSubcommand("hawtio", new CommandLine(new Hawtio(this)))
+                .addSubcommand("infra", new CommandLine(new InfraCommand(this))
+                        .addSubcommand("get", new CommandLine(new 
InfraGet(this)))
+                        .addSubcommand("list", new CommandLine(new 
InfraList(this)))
+                        .addSubcommand("log", new CommandLine(new 
InfraLog(this)))
+                        .addSubcommand("ps", new CommandLine(new 
InfraPs(this)))
+                        .addSubcommand("run", new CommandLine(new 
InfraRun(this)))
+                        .addSubcommand("stop", new CommandLine(new 
InfraStop(this))))
+                .addSubcommand("init", new CommandLine(new Init(this)))
+                .addSubcommand("jolokia", new CommandLine(new Jolokia(this)))
+                .addSubcommand("log", new CommandLine(new 
CamelLogAction(this)))
+                .addSubcommand("nano", new CommandLine(new Nano(this)))
+                .addSubcommand("plugin", new CommandLine(new 
PluginCommand(this))
+                        .addSubcommand("add", new CommandLine(new 
PluginAdd(this)))
+                        .addSubcommand("delete", new CommandLine(new 
PluginDelete(this)))
+                        .addSubcommand("get", new CommandLine(new 
PluginGet(this))))
+                .addSubcommand("ps", new CommandLine(new ListProcess(this)))
+                .addSubcommand("run", new CommandLine(new Run(this)))
+                .addSubcommand("sbom", new CommandLine(new 
SBOMGenerator(this)))
+                .addSubcommand("script", new CommandLine(new Script(this)))
+                .addSubcommand("shell", new CommandLine(new Shell(this)))
+                .addSubcommand("stop", new CommandLine(new StopProcess(this)))
+                .addSubcommand("top", new CommandLine(new CamelTop(this))
+                        .addSubcommand("context", new CommandLine(new 
CamelContextTop(this)))
+                        .addSubcommand("group", new CommandLine(new 
CamelRouteGroupTop(this)))
+                        .addSubcommand("processor", new CommandLine(new 
CamelProcessorTop(this)))
+                        .addSubcommand("route", new CommandLine(new 
CamelRouteTop(this)))
+                        .addSubcommand("source", new CommandLine(new 
CamelSourceTop(this))))
+                .addSubcommand("trace", new CommandLine(new 
CamelTraceAction(this)))
+                .addSubcommand("transform", new CommandLine(new 
TransformCommand(this))
+                        .addSubcommand("message", new CommandLine(new 
TransformMessageAction(this)))
+                        .addSubcommand("route", new CommandLine(new 
TransformRoute(this))))
+                .addSubcommand("update", new CommandLine(new 
UpdateCommand(this))
+                        .addSubcommand("list", new CommandLine(new 
UpdateList(this)))
+                        .addSubcommand("run", new CommandLine(new 
UpdateRun(this))))
+                .addSubcommand("version", new CommandLine(new 
VersionCommand(this))
+                        .addSubcommand("get", new CommandLine(new 
VersionGet(this)))
+                        .addSubcommand("list", new CommandLine(new 
VersionList(this)))
+                        .addSubcommand("set", new CommandLine(new 
VersionSet(this))))
                 .setParameterExceptionHandler(new 
MissingPluginParameterExceptionHandler());
 
-        PluginHelper.addPlugins(commandLine, main, args);
+        postAddCommands(commandLine, args);
+
+        if (discoverPlugins) {
+            PluginHelper.addPlugins(commandLine, this, args);
+        }
 
         commandLine.getCommandSpec().versionProvider(() -> {
             CamelCatalog catalog = new DefaultCamelCatalog();
@@ -211,8 +221,31 @@ public class CamelJBangMain implements Callable<Integer> {
         });
 
         CommandLineHelper.augmentWithUserConfiguration(commandLine);
+        preExecute(commandLine, args);
         int exitCode = commandLine.execute(args);
-        main.quit(exitCode);
+        postExecute(commandLine, args, exitCode);
+        quit(exitCode);
+    }
+
+    /**
+     * Called after default commands has been added
+     */
+    public void postAddCommands(CommandLine commandLine, String[] args) {
+        // noop
+    }
+
+    /**
+     * Called just before the command line is executed
+     */
+    public void preExecute(CommandLine commandLine, String[] args) {
+        // noop
+    }
+
+    /**
+     * Called just after the command line is executed
+     */
+    public void postExecute(CommandLine commandLine, String[] args, int 
exitCode) {
+        // noop
     }
 
     /**
@@ -247,6 +280,17 @@ public class CamelJBangMain implements Callable<Integer> {
         this.out = out;
     }
 
+    public boolean isDiscoverPlugins() {
+        return discoverPlugins;
+    }
+
+    /**
+     * Should custom plugins be discovered and activated
+     */
+    public void setDiscoverPlugins(boolean discoverPlugins) {
+        this.discoverPlugins = discoverPlugins;
+    }
+
     /**
      * Uses this printer for writing command output.
      *
diff --git a/dsl/camel-jbang/camel-launcher/pom.xml 
b/dsl/camel-jbang/camel-launcher/pom.xml
index f98642d79491..dbb49c266866 100644
--- a/dsl/camel-jbang/camel-launcher/pom.xml
+++ b/dsl/camel-jbang/camel-launcher/pom.xml
@@ -66,6 +66,7 @@
         <!-- Pre-installed plugins -->
         <!-- the edit plugin is not pre-installed -->
         <!-- the route-parser plugin is not pre-installed -->
+        <!-- the citrus test plugin cannot be embedded -->
         <dependency>
             <groupId>org.apache.camel</groupId>
             <artifactId>camel-jbang-plugin-generate</artifactId>
@@ -76,11 +77,6 @@
             <artifactId>camel-jbang-plugin-kubernetes</artifactId>
             <version>${project.version}</version>
         </dependency>
-        <dependency>
-            <groupId>org.apache.camel</groupId>
-            <artifactId>camel-jbang-plugin-test</artifactId>
-            <version>${project.version}</version>
-        </dependency>
         <dependency>
             <groupId>org.apache.camel</groupId>
             <artifactId>camel-jbang-plugin-validate</artifactId>
diff --git 
a/dsl/camel-jbang/camel-launcher/src/main/java/org/apache/camel/dsl/jbang/launcher/CamelLauncher.java
 
b/dsl/camel-jbang/camel-launcher/src/main/java/org/apache/camel/dsl/jbang/launcher/CamelLauncher.java
index b86976b1a464..b0104447bfd6 100644
--- 
a/dsl/camel-jbang/camel-launcher/src/main/java/org/apache/camel/dsl/jbang/launcher/CamelLauncher.java
+++ 
b/dsl/camel-jbang/camel-launcher/src/main/java/org/apache/camel/dsl/jbang/launcher/CamelLauncher.java
@@ -20,8 +20,6 @@ import java.net.URL;
 import java.net.URLDecoder;
 import java.nio.charset.StandardCharsets;
 
-import org.apache.camel.dsl.jbang.core.commands.CamelJBangMain;
-
 /**
  * Main class for the Camel JBang Fat-Jar Launcher.
  * <p>
@@ -45,7 +43,9 @@ public class CamelLauncher {
             System.setProperty("camel.launcher.jar", jarPath);
         }
 
-        CamelJBangMain.run(args);
+        CamelLauncherMain main = new CamelLauncherMain();
+        main.setDiscoverPlugins(false);
+        main.execute(args);
     }
 
     private static String detectJarPath() {
diff --git 
a/dsl/camel-jbang/camel-launcher/src/main/java/org/apache/camel/dsl/jbang/launcher/CamelLauncherMain.java
 
b/dsl/camel-jbang/camel-launcher/src/main/java/org/apache/camel/dsl/jbang/launcher/CamelLauncherMain.java
new file mode 100644
index 000000000000..594c916bfb81
--- /dev/null
+++ 
b/dsl/camel-jbang/camel-launcher/src/main/java/org/apache/camel/dsl/jbang/launcher/CamelLauncherMain.java
@@ -0,0 +1,38 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.dsl.jbang.launcher;
+
+import org.apache.camel.dsl.jbang.core.commands.CamelJBangMain;
+import org.apache.camel.dsl.jbang.core.commands.generate.GeneratePlugin;
+import org.apache.camel.dsl.jbang.core.commands.kubernetes.KubernetesPlugin;
+import org.apache.camel.dsl.jbang.core.commands.validate.ValidatePlugin;
+import picocli.CommandLine;
+
+/**
+ * Main for Camel Launcher
+ */
+public class CamelLauncherMain extends CamelJBangMain {
+
+    @Override
+    public void postAddCommands(CommandLine commandLine, String[] args) {
+        // install embedded plugins
+        new GeneratePlugin().customize(commandLine, this);
+        new KubernetesPlugin().customize(commandLine, this);
+        new ValidatePlugin().customize(commandLine, this);
+    }
+
+}
diff --git 
a/dsl/camel-jbang/camel-launcher/src/test/java/org/apache/camel/dsl/jbang/launcher/CamelLauncherTest.java
 
b/dsl/camel-jbang/camel-launcher/src/test/java/org/apache/camel/dsl/jbang/launcher/CamelLauncherTest.java
index 5051f119d7a9..787d53eed606 100644
--- 
a/dsl/camel-jbang/camel-launcher/src/test/java/org/apache/camel/dsl/jbang/launcher/CamelLauncherTest.java
+++ 
b/dsl/camel-jbang/camel-launcher/src/test/java/org/apache/camel/dsl/jbang/launcher/CamelLauncherTest.java
@@ -18,9 +18,10 @@ package org.apache.camel.dsl.jbang.launcher;
 
 import java.io.ByteArrayOutputStream;
 import java.io.PrintStream;
+import java.util.concurrent.atomic.AtomicInteger;
 
-import org.apache.camel.dsl.jbang.core.commands.CamelJBangMain;
 import org.apache.camel.dsl.jbang.core.common.Printer;
+import org.junit.jupiter.api.Assertions;
 import org.junit.jupiter.api.Test;
 
 import static org.junit.jupiter.api.Assertions.assertTrue;
@@ -67,20 +68,52 @@ public class CamelLauncherTest {
         PrintStream ps = new PrintStream(baos);
 
         // Create a custom main that doesn't exit
-        CamelJBangMain main = new CamelJBangMain() {
+        CamelLauncherMain main = new CamelLauncherMain() {
             @Override
             public void quit(int exitCode) {
                 // Do nothing to prevent System.exit
             }
         };
 
+        main.setDiscoverPlugins(false);
+
         // Set a custom printer to capture output
         main.setOut(new PrintStreamPrinter(ps));
 
         // Run the version command
-        CamelJBangMain.run(main, "version");
+        main.execute("version");
 
         String output = baos.toString();
         assertTrue(output.contains("Camel JBang version:"), "Output should 
contain version information");
     }
+
+    @Test
+    public void testLauncherValidatePlugin() {
+        ByteArrayOutputStream baos = new ByteArrayOutputStream();
+        PrintStream ps = new PrintStream(baos);
+
+        // Create a custom main that doesn't exit
+        final AtomicInteger code = new AtomicInteger();
+        CamelLauncherMain main = new CamelLauncherMain() {
+            @Override
+            public void quit(int exitCode) {
+                // Do nothing to prevent System.exit
+                code.set(exitCode);
+            }
+        };
+
+        main.setDiscoverPlugins(false);
+
+        // Set a custom printer to capture output
+        main.setOut(new PrintStreamPrinter(ps));
+
+        // Run the validate command
+        main.execute("validate", "yaml", "src/test/resources/cheese.yaml");
+
+        Assertions.assertEquals(1, code.get());
+
+        String output = baos.toString();
+        Assertions.assertTrue(output.startsWith("Validation error detected 
(errors:1)"));
+    }
+
 }
diff --git a/dsl/camel-jbang/camel-launcher/src/test/resources/bad.yaml 
b/dsl/camel-jbang/camel-launcher/src/test/resources/bad.yaml
new file mode 100644
index 000000000000..5e660e31edd0
--- /dev/null
+++ b/dsl/camel-jbang/camel-launcher/src/test/resources/bad.yaml
@@ -0,0 +1,26 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+- route:
+    from:
+      uri: timer:yaml
+      parameters:
+        period: "1000"
+      steps:
+        - setCheese:
+            simple: Hello Camel from ${routeId}
+        - log: ${body}
\ No newline at end of file

Reply via email to