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

gnodet pushed a commit to branch fix-jbang-metadata-mojo
in repository https://gitbox.apache.org/repos/asf/camel.git

commit d902a90cae2e2d2b012bbdf98b3633fa12396230
Author: Guillaume Nodet <[email protected]>
AuthorDate: Tue Mar 24 10:29:44 2026 +0100

    Fix JBang metadata generation to detect all commands
    
    The PrepareCamelJBangCommandsMojo was not discovering all commands because:
    - It searched for `new CommandLine(main)` but CamelJBangMain uses `new 
CommandLine(this)`
    - The SUBCOMMAND_PATTERN regex only matched `(main)` constructor arg, not 
`(this)`
    
    This caused several commands and options to be missing from generated docs:
    - Missing `wrapper` command, `dataweave` subcommand
    - Missing `bind` deprecation notice
    - Wrong description for `--skip-plugins` option
    
    Co-Authored-By: Claude Opus 4.6 <[email protected]>
---
 .../pages/jbang-commands/camel-jbang-bind.adoc     |  5 +++-
 .../pages/jbang-commands/camel-jbang-commands.adoc |  3 ++-
 .../pages/jbang-commands/camel-jbang-debug.adoc    |  2 +-
 .../ROOT/pages/jbang-commands/camel-jbang-run.adoc |  2 +-
 .../camel-jbang-transform-dataweave.adoc           | 29 ++++++++++++++++++++++
 .../jbang-commands/camel-jbang-transform.adoc      |  1 +
 .../pages/jbang-commands/camel-jbang-wrapper.adoc  | 28 +++++++++++++++++++++
 .../META-INF/camel-jbang-commands-metadata.json    | 11 ++++----
 .../packaging/PrepareCamelJBangCommandsMojo.java   |  7 +++---
 9 files changed, 76 insertions(+), 12 deletions(-)

diff --git 
a/docs/user-manual/modules/ROOT/pages/jbang-commands/camel-jbang-bind.adoc 
b/docs/user-manual/modules/ROOT/pages/jbang-commands/camel-jbang-bind.adoc
index ed22844f67e5..741b2066dce9 100644
--- a/docs/user-manual/modules/ROOT/pages/jbang-commands/camel-jbang-bind.adoc
+++ b/docs/user-manual/modules/ROOT/pages/jbang-commands/camel-jbang-bind.adoc
@@ -2,7 +2,10 @@
 // AUTO-GENERATED by camel-package-maven-plugin - DO NOT EDIT THIS FILE
 = camel bind
 
-Bind source and sink Kamelets as a new Camel integration
+DEPRECATED: Bind source and sink Kamelets as a new Camel integration
+
+
+CAUTION: This command is deprecated.
 
 
 == Usage
diff --git 
a/docs/user-manual/modules/ROOT/pages/jbang-commands/camel-jbang-commands.adoc 
b/docs/user-manual/modules/ROOT/pages/jbang-commands/camel-jbang-commands.adoc
index edfd48586a31..8d9e0406c6a9 100644
--- 
a/docs/user-manual/modules/ROOT/pages/jbang-commands/camel-jbang-commands.adoc
+++ 
b/docs/user-manual/modules/ROOT/pages/jbang-commands/camel-jbang-commands.adoc
@@ -11,7 +11,7 @@ TIP: You can also use `camel --help` or `camel <command> 
--help` to see availabl
 [cols="2,5",options="header"]
 |===
 | Command | Description
-| xref:jbang-commands/camel-jbang-bind.adoc[camel bind] | Bind source and sink 
Kamelets as a new Camel integration
+| xref:jbang-commands/camel-jbang-bind.adoc[camel bind] | DEPRECATED: Bind 
source and sink Kamelets as a new Camel integration
 | xref:jbang-commands/camel-jbang-catalog.adoc[camel catalog] | List artifacts 
from Camel Catalog
 | xref:jbang-commands/camel-jbang-cmd.adoc[camel cmd] | Performs commands in 
the running Camel integrations, such as start/stop route, or change logging 
levels.
 | xref:jbang-commands/camel-jbang-completion.adoc[camel completion] | Generate 
completion script for bash/zsh
@@ -43,4 +43,5 @@ TIP: You can also use `camel --help` or `camel <command> 
--help` to see availabl
 | xref:jbang-commands/camel-jbang-transform.adoc[camel transform] | Transform 
message or Camel routes
 | xref:jbang-commands/camel-jbang-update.adoc[camel update] | Update Camel 
project
 | xref:jbang-commands/camel-jbang-version.adoc[camel version] | Manage Camel 
versions
+| xref:jbang-commands/camel-jbang-wrapper.adoc[camel wrapper] | Install Camel 
wrapper scripts for version pinning
 |===
diff --git 
a/docs/user-manual/modules/ROOT/pages/jbang-commands/camel-jbang-debug.adoc 
b/docs/user-manual/modules/ROOT/pages/jbang-commands/camel-jbang-debug.adoc
index f7bcff1d740b..e56d29f27a38 100644
--- a/docs/user-manual/modules/ROOT/pages/jbang-commands/camel-jbang-debug.adoc
+++ b/docs/user-manual/modules/ROOT/pages/jbang-commands/camel-jbang-debug.adoc
@@ -83,7 +83,7 @@ camel debug [options]
 | `--show-exchange-properties` | Show exchange properties in debug messages | 
false | boolean
 | `--show-exchange-variables` | Show exchange variables in debug messages | 
true | boolean
 | `--show-headers` | Show message headers in debug messages | true | boolean
-| `--skip-plugins` | Skip plugins during export | false | boolean
+| `--skip-plugins` | Skip resolving plugin dependencies | false | boolean
 | `--source` | Prefer to display source filename/code instead of IDs |  | 
boolean
 | `--source-dir` | Source directory for dynamically loading Camel file(s) to 
run. When using this, then files cannot be specified at the same time. |  | 
String
 | `--spring-boot-version` | Spring Boot version | 
RuntimeType.SPRING_BOOT_VERSION | String
diff --git 
a/docs/user-manual/modules/ROOT/pages/jbang-commands/camel-jbang-run.adoc 
b/docs/user-manual/modules/ROOT/pages/jbang-commands/camel-jbang-run.adoc
index 51f62b485982..8d5576320735 100644
--- a/docs/user-manual/modules/ROOT/pages/jbang-commands/camel-jbang-run.adoc
+++ b/docs/user-manual/modules/ROOT/pages/jbang-commands/camel-jbang-run.adoc
@@ -71,7 +71,7 @@ camel run [options]
 | `--reload,--dev` | Enables dev mode (live reload when source files are 
updated and saved) |  | boolean
 | `--repo,--repos` | Additional maven repositories (Use commas to separate 
multiple repositories) |  | String
 | `--runtime` | Runtime () | camel-main | RuntimeType
-| `--skip-plugins` | Skip plugins during export | false | boolean
+| `--skip-plugins` | Skip resolving plugin dependencies | false | boolean
 | `--source-dir` | Source directory for dynamically loading Camel file(s) to 
run. When using this, then files cannot be specified at the same time. |  | 
String
 | `--spring-boot-version` | Spring Boot version | 
RuntimeType.SPRING_BOOT_VERSION | String
 | `--stub` | Stubs all the matching endpoint uri with the given component name 
or pattern. Multiple names can be separated by comma. (all = stub all 
endpoints). |  | String
diff --git 
a/docs/user-manual/modules/ROOT/pages/jbang-commands/camel-jbang-transform-dataweave.adoc
 
b/docs/user-manual/modules/ROOT/pages/jbang-commands/camel-jbang-transform-dataweave.adoc
new file mode 100644
index 000000000000..27ce882fc402
--- /dev/null
+++ 
b/docs/user-manual/modules/ROOT/pages/jbang-commands/camel-jbang-transform-dataweave.adoc
@@ -0,0 +1,29 @@
+
+// AUTO-GENERATED by camel-package-maven-plugin - DO NOT EDIT THIS FILE
+= camel transform dataweave
+
+Convert DataWeave scripts to DataSonnet format
+
+
+== Usage
+
+[source,bash]
+----
+camel transform dataweave [options]
+----
+
+
+
+== Options
+
+[cols="2,5,1,2",options="header"]
+|===
+| Option | Description | Default | Type
+| `--expression,-e` | Inline DataWeave expression to convert |  | String
+| `--include-comments` | Include conversion notes as comments in output | true 
| boolean
+| `--input,-i` | Input .dwl file or directory containing .dwl files |  | String
+| `--output,-o` | Output .ds file or directory (defaults to stdout) |  | String
+| `-h,--help` | Display the help and sub-commands |  | boolean
+|===
+
+
diff --git 
a/docs/user-manual/modules/ROOT/pages/jbang-commands/camel-jbang-transform.adoc 
b/docs/user-manual/modules/ROOT/pages/jbang-commands/camel-jbang-transform.adoc
index 782e71c87cef..79c46f128eea 100644
--- 
a/docs/user-manual/modules/ROOT/pages/jbang-commands/camel-jbang-transform.adoc
+++ 
b/docs/user-manual/modules/ROOT/pages/jbang-commands/camel-jbang-transform.adoc
@@ -18,6 +18,7 @@ camel transform [options]
 [cols="2,5",options="header"]
 |===
 | Subcommand | Description
+| xref:jbang-commands/camel-jbang-transform-dataweave.adoc[dataweave] | 
Convert DataWeave scripts to DataSonnet format
 | xref:jbang-commands/camel-jbang-transform-message.adoc[message] | Transform 
message from one format to another via an existing running Camel integration
 | xref:jbang-commands/camel-jbang-transform-route.adoc[route] | Transform 
Camel routes to XML or YAML format
 |===
diff --git 
a/docs/user-manual/modules/ROOT/pages/jbang-commands/camel-jbang-wrapper.adoc 
b/docs/user-manual/modules/ROOT/pages/jbang-commands/camel-jbang-wrapper.adoc
new file mode 100644
index 000000000000..85299e1738df
--- /dev/null
+++ 
b/docs/user-manual/modules/ROOT/pages/jbang-commands/camel-jbang-wrapper.adoc
@@ -0,0 +1,28 @@
+
+// AUTO-GENERATED by camel-package-maven-plugin - DO NOT EDIT THIS FILE
+= camel wrapper
+
+Install Camel wrapper scripts for version pinning
+
+
+== Usage
+
+[source,bash]
+----
+camel wrapper [options]
+----
+
+
+
+== Options
+
+[cols="2,5,1,2",options="header"]
+|===
+| Option | Description | Default | Type
+| `--camel-version` | Camel version to pin (defaults to current version) |  | 
String
+| `--dir,--directory` | Directory where wrapper files will be created | . | 
String
+| `--repo-url` | Maven repository URL for downloading the launcher | 
DEFAULT_REPO_URL | String
+| `-h,--help` | Display the help and sub-commands |  | boolean
+|===
+
+
diff --git 
a/dsl/camel-jbang/camel-jbang-core/src/generated/resources/META-INF/camel-jbang-commands-metadata.json
 
b/dsl/camel-jbang/camel-jbang-core/src/generated/resources/META-INF/camel-jbang-commands-metadata.json
index 98bf97804a90..9dc900fd33d4 100644
--- 
a/dsl/camel-jbang/camel-jbang-core/src/generated/resources/META-INF/camel-jbang-commands-metadata.json
+++ 
b/dsl/camel-jbang/camel-jbang-core/src/generated/resources/META-INF/camel-jbang-commands-metadata.json
@@ -1,11 +1,11 @@
 {
   "commands": [
-    { "name": "bind", "fullName": "bind", "description": "Bind source and sink 
Kamelets as a new Camel integration", "sourceClass": 
"org.apache.camel.dsl.jbang.core.commands.bind.Bind", "options": [ { "names": 
"--error-handler", "description": "Add error handler 
(none|log|sink:<endpoint>). Sink endpoints are expected in the format 
[[apigroup\/]version:]kind:[namespace\/]name, plain Camel URIs or Kamelet 
name.", "javaType": "java.lang.String", "type": "string" }, { "names": 
"--output", "d [...]
+    { "name": "bind", "fullName": "bind", "description": "DEPRECATED: Bind 
source and sink Kamelets as a new Camel integration", "deprecated": true, 
"sourceClass": "org.apache.camel.dsl.jbang.core.commands.bind.Bind", "options": 
[ { "names": "--error-handler", "description": "Add error handler 
(none|log|sink:<endpoint>). Sink endpoints are expected in the format 
[[apigroup\/]version:]kind:[namespace\/]name, plain Camel URIs or Kamelet 
name.", "javaType": "java.lang.String", "type": "stri [...]
     { "name": "catalog", "fullName": "catalog", "description": "List artifacts 
from Camel Catalog", "sourceClass": 
"org.apache.camel.dsl.jbang.core.commands.catalog.CatalogCommand", "options": [ 
{ "names": "-h,--help", "description": "Display the help and sub-commands", 
"javaType": "boolean", "type": "boolean" } ], "subcommands": [ { "name": 
"component", "fullName": "catalog component", "description": "List components 
from the Camel Catalog", "sourceClass": "org.apache.camel.dsl.jbang.co [...]
     { "name": "cmd", "fullName": "cmd", "description": "Performs commands in 
the running Camel integrations, such as start\/stop route, or change logging 
levels.", "sourceClass": 
"org.apache.camel.dsl.jbang.core.commands.action.CamelAction", "options": [ { 
"names": "-h,--help", "description": "Display the help and sub-commands", 
"javaType": "boolean", "type": "boolean" } ], "subcommands": [ { "name": 
"browse", "fullName": "cmd browse", "description": "Browse pending messages on 
endpoints [...]
     { "name": "completion", "fullName": "completion", "description": "Generate 
completion script for bash\/zsh", "sourceClass": 
"org.apache.camel.dsl.jbang.core.commands.Complete", "options": [ { "names": 
"-h,--help", "description": "Display the help and sub-commands", "javaType": 
"boolean", "type": "boolean" } ] },
     { "name": "config", "fullName": "config", "description": "Get and set user 
configuration values", "sourceClass": 
"org.apache.camel.dsl.jbang.core.commands.config.ConfigCommand", "options": [ { 
"names": "-h,--help", "description": "Display the help and sub-commands", 
"javaType": "boolean", "type": "boolean" } ], "subcommands": [ { "name": "get", 
"fullName": "config get", "description": "Display user configuration value", 
"sourceClass": "org.apache.camel.dsl.jbang.core.commands.config. [...]
-    { "name": "debug", "fullName": "debug", "description": "Debug local Camel 
integration", "sourceClass": "org.apache.camel.dsl.jbang.core.commands.Debug", 
"options": [ { "names": "--ago", "description": "Use ago instead of yyyy-MM-dd 
HH:mm:ss in timestamp.", "javaType": "boolean", "type": "boolean" }, { "names": 
"--background", "description": "Run in the background", "defaultValue": 
"false", "javaType": "boolean", "type": "boolean" }, { "names": 
"--background-wait", "description": "To  [...]
+    { "name": "debug", "fullName": "debug", "description": "Debug local Camel 
integration", "sourceClass": "org.apache.camel.dsl.jbang.core.commands.Debug", 
"options": [ { "names": "--ago", "description": "Use ago instead of yyyy-MM-dd 
HH:mm:ss in timestamp.", "javaType": "boolean", "type": "boolean" }, { "names": 
"--background", "description": "Run in the background", "defaultValue": 
"false", "javaType": "boolean", "type": "boolean" }, { "names": 
"--background-wait", "description": "To  [...]
     { "name": "dependency", "fullName": "dependency", "description": "Displays 
all Camel dependencies required to run", "sourceClass": 
"org.apache.camel.dsl.jbang.core.commands.DependencyCommand", "options": [ { 
"names": "-h,--help", "description": "Display the help and sub-commands", 
"javaType": "boolean", "type": "boolean" } ], "subcommands": [ { "name": 
"copy", "fullName": "dependency copy", "description": "Copies all Camel 
dependencies required to run to a specific directory", "sourc [...]
     { "name": "dirty", "fullName": "dirty", "description": "Check if there are 
dirty files from previous Camel runs that did not terminate gracefully", 
"sourceClass": "org.apache.camel.dsl.jbang.core.commands.process.Dirty", 
"options": [ { "names": "--clean", "description": "Clean dirty files which are 
no longer in use", "defaultValue": "false", "javaType": "boolean", "type": 
"boolean" }, { "names": "-h,--help", "description": "Display the help and 
sub-commands", "javaType": "boolean", " [...]
     { "name": "doc", "fullName": "doc", "description": "Shows documentation 
for kamelet, component, and other Camel resources", "sourceClass": 
"org.apache.camel.dsl.jbang.core.commands.catalog.CatalogDoc", "options": [ { 
"names": "--camel-version", "description": "To use a different Camel version 
than the default version", "javaType": "java.lang.String", "type": "string" }, 
{ "names": "--download", "description": "Whether to allow automatic downloading 
JAR dependencies (over the internet [...]
@@ -22,15 +22,16 @@
     { "name": "nano", "fullName": "nano", "description": "Nano editor to edit 
file", "sourceClass": "org.apache.camel.dsl.jbang.core.commands.Nano", 
"options": [ { "names": "-h,--help", "description": "Display the help and 
sub-commands", "javaType": "boolean", "type": "boolean" } ] },
     { "name": "plugin", "fullName": "plugin", "description": "Manage plugins 
that add sub-commands to this CLI", "sourceClass": 
"org.apache.camel.dsl.jbang.core.commands.plugin.PluginCommand", "options": [ { 
"names": "-h,--help", "description": "Display the help and sub-commands", 
"javaType": "boolean", "type": "boolean" } ], "subcommands": [ { "name": "add", 
"fullName": "plugin add", "description": "Add new plugin", "sourceClass": 
"org.apache.camel.dsl.jbang.core.commands.plugin.PluginA [...]
     { "name": "ps", "fullName": "ps", "description": "List running Camel 
integrations", "sourceClass": 
"org.apache.camel.dsl.jbang.core.commands.process.ListProcess", "options": [ { 
"names": "--json", "description": "Output in JSON Format", "javaType": 
"boolean", "type": "boolean" }, { "names": "--pid", "description": "List only 
pid in the output", "javaType": "boolean", "type": "boolean" }, { "names": 
"--remote", "description": "Break down counters into remote\/total pairs", 
"javaType": [...]
-    { "name": "run", "fullName": "run", "description": "Run as local Camel 
integration", "sourceClass": "org.apache.camel.dsl.jbang.core.commands.Run", 
"options": [ { "names": "--background", "description": "Run in the background", 
"defaultValue": "false", "javaType": "boolean", "type": "boolean" }, { "names": 
"--background-wait", "description": "To wait for run in background to startup 
successfully, before returning", "defaultValue": "true", "javaType": "boolean", 
"type": "boolean" }, { [...]
+    { "name": "run", "fullName": "run", "description": "Run as local Camel 
integration", "sourceClass": "org.apache.camel.dsl.jbang.core.commands.Run", 
"options": [ { "names": "--background", "description": "Run in the background", 
"defaultValue": "false", "javaType": "boolean", "type": "boolean" }, { "names": 
"--background-wait", "description": "To wait for run in background to startup 
successfully, before returning", "defaultValue": "true", "javaType": "boolean", 
"type": "boolean" }, { [...]
     { "name": "sbom", "fullName": "sbom", "description": "Generate a CycloneDX 
or SPDX SBOM for a specific project", "sourceClass": 
"org.apache.camel.dsl.jbang.core.commands.SBOMGenerator", "options": [ { 
"names": "--build-property", "description": "Maven build properties, ex. 
--build-property=prop1=foo", "javaType": "java.util.List", "type": "array" }, { 
"names": "--camel-spring-boot-version", "description": "Camel version to use 
with Spring Boot", "javaType": "java.lang.String", "type" [...]
     { "name": "script", "fullName": "script", "description": "Run Camel 
integration as shell script for terminal scripting", "sourceClass": 
"org.apache.camel.dsl.jbang.core.commands.Script", "options": [ { "names": 
"--logging", "description": "Can be used to turn on logging (logs to file in 
<user home>\/.camel directory)", "defaultValue": "false", "javaType": 
"boolean", "type": "boolean" }, { "names": "--logging-level", "description": 
"Logging level ()", "defaultValue": "info", "javaType [...]
     { "name": "shell", "fullName": "shell", "description": "Interactive Camel 
JBang shell.", "sourceClass": "org.apache.camel.dsl.jbang.core.commands.Shell", 
"options": [ { "names": "-h,--help", "description": "Display the help and 
sub-commands", "javaType": "boolean", "type": "boolean" } ] },
     { "name": "stop", "fullName": "stop", "description": "Shuts down running 
Camel integrations", "sourceClass": 
"org.apache.camel.dsl.jbang.core.commands.process.StopProcess", "options": [ { 
"names": "--kill", "description": "To force killing the process (SIGKILL)", 
"javaType": "boolean", "type": "boolean" }, { "names": "-h,--help", 
"description": "Display the help and sub-commands", "javaType": "boolean", 
"type": "boolean" } ] },
     { "name": "top", "fullName": "top", "description": "Top status of Camel 
integrations", "sourceClass": 
"org.apache.camel.dsl.jbang.core.commands.process.CamelTop", "options": [ { 
"names": "--watch", "description": "Execute periodically and showing output 
fullscreen", "javaType": "boolean", "type": "boolean" }, { "names": 
"-h,--help", "description": "Display the help and sub-commands", "javaType": 
"boolean", "type": "boolean" } ], "subcommands": [ { "name": "context", 
"fullName": "top  [...]
     { "name": "trace", "fullName": "trace", "description": "Tail message 
traces from running Camel integrations", "sourceClass": 
"org.apache.camel.dsl.jbang.core.commands.action.CamelTraceAction", "options": 
[ { "names": "--action", "description": "Action to start, stop, clear, list 
status, or dump traces", "defaultValue": "status", "javaType": 
"java.lang.String", "type": "string" }, { "names": "--ago", "description": "Use 
ago instead of yyyy-MM-dd HH:mm:ss in timestamp.", "javaType": "b [...]
-    { "name": "transform", "fullName": "transform", "description": "Transform 
message or Camel routes", "sourceClass": 
"org.apache.camel.dsl.jbang.core.commands.TransformCommand", "options": [ { 
"names": "-h,--help", "description": "Display the help and sub-commands", 
"javaType": "boolean", "type": "boolean" } ], "subcommands": [ { "name": 
"message", "fullName": "transform message", "description": "Transform message 
from one format to another via an existing running Camel integration", " [...]
+    { "name": "transform", "fullName": "transform", "description": "Transform 
message or Camel routes", "sourceClass": 
"org.apache.camel.dsl.jbang.core.commands.TransformCommand", "options": [ { 
"names": "-h,--help", "description": "Display the help and sub-commands", 
"javaType": "boolean", "type": "boolean" } ], "subcommands": [ { "name": 
"dataweave", "fullName": "transform dataweave", "description": "Convert 
DataWeave scripts to DataSonnet format", "sourceClass": "org.apache.camel.dsl. 
[...]
     { "name": "update", "fullName": "update", "description": "Update Camel 
project", "sourceClass": 
"org.apache.camel.dsl.jbang.core.commands.update.UpdateCommand", "options": [ { 
"names": "-h,--help", "description": "Display the help and sub-commands", 
"javaType": "boolean", "type": "boolean" } ], "subcommands": [ { "name": 
"list", "fullName": "update list", "description": "List available update 
versions for Camel and its runtime variants", "sourceClass": 
"org.apache.camel.dsl.jbang.cor [...]
-    { "name": "version", "fullName": "version", "description": "Manage Camel 
versions", "sourceClass": 
"org.apache.camel.dsl.jbang.core.commands.version.VersionCommand", "options": [ 
{ "names": "-h,--help", "description": "Display the help and sub-commands", 
"javaType": "boolean", "type": "boolean" } ], "subcommands": [ { "name": "get", 
"fullName": "version get", "description": "Displays current Camel version", 
"sourceClass": "org.apache.camel.dsl.jbang.core.commands.version.VersionGet", 
[...]
+    { "name": "version", "fullName": "version", "description": "Manage Camel 
versions", "sourceClass": 
"org.apache.camel.dsl.jbang.core.commands.version.VersionCommand", "options": [ 
{ "names": "-h,--help", "description": "Display the help and sub-commands", 
"javaType": "boolean", "type": "boolean" } ], "subcommands": [ { "name": "get", 
"fullName": "version get", "description": "Displays current Camel version", 
"sourceClass": "org.apache.camel.dsl.jbang.core.commands.version.VersionGet", 
[...]
+    { "name": "wrapper", "fullName": "wrapper", "description": "Install Camel 
wrapper scripts for version pinning", "sourceClass": 
"org.apache.camel.dsl.jbang.core.commands.WrapperCommand", "options": [ { 
"names": "--camel-version", "description": "Camel version to pin (defaults to 
current version)", "javaType": "java.lang.String", "type": "string" }, { 
"names": "--dir,--directory", "description": "Directory where wrapper files 
will be created", "defaultValue": ".", "javaType": "java.lan [...]
   ]
 }
diff --git 
a/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/PrepareCamelJBangCommandsMojo.java
 
b/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/PrepareCamelJBangCommandsMojo.java
index 078fccd7d162..65d63110eb78 100644
--- 
a/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/PrepareCamelJBangCommandsMojo.java
+++ 
b/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/PrepareCamelJBangCommandsMojo.java
@@ -56,9 +56,9 @@ import org.jboss.forge.roaster.model.source.JavaClassSource;
       requiresDependencyResolution = ResolutionScope.COMPILE)
 public class PrepareCamelJBangCommandsMojo extends AbstractGeneratorMojo {
 
-    // Pattern to match .addSubcommand("name", new CommandLine(new 
ClassName(main))
+    // Pattern to match .addSubcommand("name", new CommandLine(new 
ClassName(this/main))
     private static final Pattern SUBCOMMAND_PATTERN = Pattern.compile(
-            
"\\.addSubcommand\\(\\s*\"([^\"]+)\"\\s*,\\s*new\\s+CommandLine\\(\\s*new\\s+([A-Za-z0-9_]+)\\s*\\(\\s*main\\s*\\)\\s*\\)");
+            
"\\.addSubcommand\\(\\s*\"([^\"]+)\"\\s*,\\s*new\\s+CommandLine\\(\\s*new\\s+([A-Za-z0-9_]+)\\s*\\(\\s*(?:this|main)\\s*\\)\\s*\\)");
 
     @Parameter(defaultValue = "${project.basedir}/src/generated/resources")
     protected File outFolder;
@@ -164,7 +164,8 @@ public class PrepareCamelJBangCommandsMojo extends 
AbstractGeneratorMojo {
         // Find the start of the commandLine builder chain
         int startLine = -1;
         for (int i = 0; i < lines.size(); i++) {
-            if (lines.get(i).contains("commandLine = new CommandLine(main)")) {
+            if (lines.get(i).contains("commandLine = new CommandLine(this)")
+                    || lines.get(i).contains("commandLine = new 
CommandLine(main)")) {
                 startLine = i;
                 break;
             }

Reply via email to