Camel CLI - Export to Maven
Export your Camel CLI integrations to production-ready Maven projects, manage dependencies, and upgrade Camel versions.
Creating Projects
Export your Camel CLI integration to a Maven-based project for Spring Boot, Quarkus, or standalone Camel Main.
camel export --runtime=spring-boot --gav=com.foo:acme:1.0-SNAPSHOT
camel export --runtime=quarkus --gav=com.foo:acme:1.0-SNAPSHOT
camel export --runtime=camel-main --gav=com.foo:acme:1.0-SNAPSHOT Without --directory, files are exported to the current directory. Use --directory=../myproject to copy to a separate folder. |
Run camel export --help for all options. |
Notes:
-
The Quarkus platform version is automatically resolved from the registry based on the Camel version.
-
The
--profileoption is not supported when exporting to Quarkus. -
For Spring Boot, you can override versions with
--camel-spring-boot-version.
Exporting with a parent POM
When organizations run many Camel integrations, they typically use a parent POM to standardize plugin versions, required extensions, and common dependencies. Use --parent-pom to set the parent POM in the exported project:
camel export --runtime=quarkus --gav=com.foo:acme:1.0-SNAPSHOT --parent-pom=com.ourorg:camel-parent:1.0 This generates the <parent> block in the exported pom.xml:
<parent>
<groupId>com.ourorg</groupId>
<artifactId>camel-parent</artifactId>
<version>1.0</version>
<relativePath/>
</parent> For Spring Boot, specifying --parent-pom replaces the default spring-boot-starter-parent. The Spring Boot BOM (spring-boot-dependencies) remains in <dependencyManagement>, so version management continues to work.
You can also configure this in application.properties:
camel.jbang.parentPom=com.ourorg:camel-parent:1.0 Exporting with Java Agent included
Only camel-main runtime supports Java Agents. |
Specify the agent with agent: prefix in application.properties:
camel.jbang.dependencies=camel:opentelemetry,agent:io.opentelemetry.javaagent:opentelemetry-javaagent:1.31.0
camel.opentelemetry.enabled=true Export and run:
camel export --runtime=camel-main --gav=com.foo:acme:1.0-SNAPSHOT --directory=../myproject
cd ../myproject
mvn clean package
java -javaagent:agent/opentelemetry-javaagent-1.31.0.jar -jar target/acme-1.0-SNAPSHOT.jar The agent JAR is downloaded from Maven and saved to the agent/ folder.
Exporting with selected files
By default, all files from the current directory are exported. Specify files explicitly to split into multiple projects:
camel export Foo.java --runtime=quarkus --gav=com.foo:acme:1.0-SNAPSHOT --directory=../export1
camel export bar.xml cheese.yaml --runtime=spring-boot --gav=com.foo:cheese:1.0-SNAPSHOT --directory=../export2 application.properties is included in all exports automatically. |
Exporting with Camel Wrapper
Use --camel-wrapper to include Camel Wrapper scripts in the exported project. This works like the Maven Wrapper — it pins a specific Camel CLI version so that anyone working on the project uses the same version without a separate install:
camel export --runtime=spring-boot --gav=com.foo:acme:1.0-SNAPSHOT --camel-wrapper This adds the following files to the exported project:
-
camelandcamel.cmd— launcher scripts that download and run the pinned Camel CLI version -
.camel/camel-wrapper.properties— contains the pinnedcamel.versionand download URL
The pinned version matches the Camel version used in the export. After exporting, use ./camel instead of a globally installed camel to ensure the project always uses the correct version.
You can also set this in application.properties:
camel.jbang.camelWrapper=true The Camel Wrapper can also be installed standalone with camel wrapper. See Installation Options for details. |
Including JMX management or CLI connector
JMX management and CLI connector are not included by default. Add them with --dep:
camel export --runtime=quarkus --gav=com.foo:acme:1.0-SNAPSHOT --dep=camel:management
camel export --runtime=quarkus --gav=com.foo:acme:1.0-SNAPSHOT --dep=camel:cli-connector Including resource directories
To include entire directories of resource files (such as XSD schemas, WSDL files, etc.) in the exported project while preserving their directory structure, use --resource-dirs:
camel export --resource-dirs=soap This recursively copies all files from the soap/ directory into src/main/resources/soap/, preserving the directory structure. For example, soap/schemas/common.xsd becomes src/main/resources/soap/schemas/common.xsd.
Multiple directories can be specified with commas:
camel export --resource-dirs=soap,wsdl You can also reference directories outside the current project using relative paths. When using .. paths, only the last directory name is used as the target:
camel export --resource-dirs=../shared/schemas This copies the contents into src/main/resources/schemas/.
Absolute paths (e.g., /some/path) are not allowed. The directory is limited to at most 1000 files as a safety measure. |
Troubleshooting exporting
Use --verbose and --logging for more detail, or --logging-level=DEBUG for full output. Try --ignore-loading-error if custom Java code prevents export.
Export logs are stored in ~/.camel/camel-export.log by default. |
Configuring exporting
Export loads configuration from application.properties, where you can set runtime, Java version, and other parameters. See Configuration for all camel.jbang.* options.
Gathering list of dependencies
List the Camel components and JARs required to run your integration:
camel dependency list
org.apache.camel:camel-dsl-modeline:3.20.0
org.apache.camel:camel-health:3.20.0
org.apache.camel:camel-kamelet:3.20.0
org.apache.camel:camel-log:3.20.0
... Output defaults to GAV format. Use --output=maven for Maven XML format. Use --runtime=spring-boot or --runtime=quarkus for runtime-specific dependencies.
Generating SBOM report
Generate a Software Bill of Materials for your integration:
camel sbom
camel sbom --sbom-format=spdx
camel sbom --runtime=quarkus Defaults to CycloneDX format (sbom.json) with camel-main runtime.
Manage plugins
Plugins extend the CLI with additional commands. List available plugins (ASF and community):
camel plugin get --all The plugins of the Apache Camel project:
| Plugin | Commands |
|---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Plugins bundled with the CLI, such as tui, are installed on first use.
Add, list installed, and remove plugins:
camel plugin add generate
camel plugin add forage
camel plugin get
camel plugin delete <plugin-name> Plugin versions
The plugins of the Apache Camel project always use the version of the CLI.
A community plugin, such as forage or kit, is released on its own, and each release is built for a Camel version. camel plugin add <name> selects the newest release of the plugin built for the version of the installed CLI, and prints it:
$ camel plugin add forage
Selected forage 1.6.2 for Camel CLI 4.22.2 (built for Camel 4.22.2)
Plugin forage added To select the release, the CLI lists the releases of the plugin from the Maven repositories it is configured with: Maven Central, the repositories of the active profiles in the Maven settings.xml (with its mirrors applied), and the repositories given with --repos (or by the catalog of known plugins). The list is always checked again in these repositories, so a new release is found. Releases with a qualifier, such as -SNAPSHOT or -RC1, are not used.
The releases are grouped by release line of the plugin (its major and minor version: 1.6.0, 1.6.1 and 1.6.2 are the line 1.6), and the CLI reads the POM of the newest release of each line, newest line first (at most 10 lines). The Camel versions a release supports are:
-
the Maven version range in the property
camel.jbang.plugin.camel-versionsof its POM, when the plugin declares it (see Building custom plugins) -
otherwise the minor version of Camel of its
org.apache.camel:camel-jbang-coredependency: a release built with Camel 4.22.2 supports Camel 4.22.x (the range[4.22.0,4.23.0))
A SNAPSHOT build of the CLI is compared without -SNAPSHOT. The --camel-version option of the commands is not used for this: it is the version of the installed CLI that counts.
camel plugin add downloads the selected release before it saves the configuration, and stores the exact version in ~/.camel-jbang-plugins.json, together with the Camel versions it supports. The plugin therefore stays at that version: run camel plugin add <name> again to select the newest matching release, for example after a new patch release of the plugin. When the CLI is upgraded to a Camel version that the stored release does not support, the CLI warns when the plugin is loaded, and tells to run camel plugin add <name> again. Plugins added with an older CLI are not checked.
The CLI selects the newest release of the first line that supports its version. When no release read supports it:
-
if the CLI is newer than the Camel versions of all the releases (for example, the plugin has no release for a new Camel version yet),
camel plugin addwarns and uses the newest release (MavenLATEST), as older versions of the CLI do -
if the CLI is between the Camel versions of the releases, it selects the newest release for the nearest older Camel version, and warns
-
if the CLI is older than the Camel versions of all the releases read, or no release tells which Camel versions it supports, it warns and uses
LATEST
The warnings list the newest release per Camel version found. When the releases cannot be read (for example, when offline), camel plugin add warns that it could not check the compatibility, and uses LATEST.
To use a specific release, give its version, or the Maven coordinates of the plugin. It is used as given; the CLI only warns when the release is known to be built for another Camel version:
camel plugin add forage --version 1.6.2
camel plugin add forage --gav io.kaoto.forage:camel-jbang-plugin-forage:1.6.2 Older versions of the CLI do not select a release, and use the newest one. With them, give the release the plugin documents for your Camel version with --version, or with --gav before Camel 4.21, where the CLI does not know the Maven groupId of community plugins yet (and --version alone looks for the plugin in the org.apache.camel group). For example, Forage 1.4.2 is built for Camel 4.18:
camel plugin add forage --gav io.kaoto.forage:camel-jbang-plugin-forage:1.4.2 Building custom plugins
It is possible to build custom Camel CLI plugins. We suggest to take a look at one of the existing plugins, to see how that is done.
The name of the plugin Maven artifactId must start with camel-jbang-plugin-. For example if the plugin is named cheese, then the maven artifact must be named camel-jbang-plugin-cheese. |
A plugin should declare the Camel versions each release supports, as a Maven version range in the property camel.jbang.plugin.camel-versions of the POM of the plugin, so camel plugin add selects the right release (see Plugin versions):
<properties>
<camel.jbang.plugin.camel-versions>[4.23.0,4.24.0)</camel.jbang.plugin.camel-versions>
</properties> Keep the value a literal range, updated together with the Camel version the plugin is built with. A value that is not a version range (such as a single version) is ignored. Without the property, a release is taken to support the minor version of Camel of its org.apache.camel:camel-jbang-core dependency.
Generate plugin
REST DSL from OpenAPI
Generate the REST DSL (YAML or XML) from an OpenAPI specification, for contract-first REST development:
camel generate rest --input=petstore.yaml --output=petstore-rest.yaml
camel generate rest --input=petstore.yaml --output=petstore-rest.yaml --routes
camel generate rest --input=petstore.yaml --dto --runtime=quarkus --package=com.acme.model --routes also generates a route for each operation (YAML only), and --dto generates Java data objects for the schemas of the specification.
Version management
Show the current Camel CLI version:
camel version Running with a different version
Use --camel-version to run with a specific Camel version:
camel run * --camel-version=3.18.4 Or set a persistent version override:
camel version set 3.18.2
camel version set --reset You cannot combine camel version set with --camel-version. |
For SNAPSHOT versions:
jbang --fresh -Dcamel.jbang.version=3.21.0-SNAPSHOT camel@apache/camel [command] Listing available releases
Show available Camel releases from Maven Central:
camel version list
CAMEL VERSION JDK KIND RELEASED SUPPORTED UNTIL
3.18.0 11,17 LTS July 2022 July 2023
3.20.0 11,17 LTS December 2022 December 2023
4.0.0-M1 17 RC February 2023
... Use --runtime=quarkus or --runtime=spring-boot to see runtime-specific versions. Use --from-version=3.0 to show older releases (back to Camel 2.18).
Run camel version list --help for all options. |
Automated updates (OpenRewrite)
Update Camel applications automatically using OpenRewrite recipes. Supports Camel Main, Spring Boot, and Quarkus.
List available updates and run:
camel update list
camel update run 4.9.0 --runtime=spring-boot --dry-run Run from the project directory containing pom.xml. |
Options: --runtime (camel-main, spring-boot, quarkus), --repos (extra Maven repos), --dry-run (preview only), --extraActiveRecipes, --extraRecipeArtifactCoordinates.
Run camel update run --help for all options. |