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
Add, list installed, and remove plugins:
camel plugin add generate
camel plugin add forage --version=1.2.3
camel plugin get
camel plugin delete <plugin-name>
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.
|
Generate JSON schema plugin
Generate JSON Schema definitions from Java objects for use with visual development tools (Kaoto, Karavan):
camel generate schema fhir org.hl7.fhir.r4.model.Patient
Schema saved to: ./org.hl7.fhir.r4.model.Patient-schema.json
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.
|