Camel K Modeline

Integration files can contain modeline hooks that allow to customize the way integrations are executed via command line.

For example, take the following integration file:
// camel-k: (1)

import org.apache.camel.builder.RouteBuilder;

public class Hello extends RouteBuilder {
  public void configure() throws Exception {

        .bean( (2)

1 Modeline import of Maven library
2 Usage of a business logic class from the external library

When the integration code above is executed using the kamel run CLI command, the modeline options declared in the file are appended to the list of arguments that are passed to the command.

The kamel CLI will alert you, printing the full command in the shell:

$ kamel run
Modeline options have been loaded from source files
Full command: kamel run --dependency

Multiple options, even of the same type, can be specified for an integration. For example the following modeline options make sure that the integration runs on the Quarkus runtime and enable the 3scale exposure.
// camel-k: trait=quarkus.enabled=true trait=3scale.enabled=true (1)

import org.apache.camel.builder.RouteBuilder;

public class QuarkusRest extends RouteBuilder {
  public void configure() throws Exception {


1 Enable both the Quarkus and 3scale traits, to run the integration on Quarkus and expose the routes via 3scale

All options that are available for the kamel run command can be specified as modeline options. The following is a partial list of useful options:

Table 1. Useful Modeline Options
Option Description


An external library that should be included. E.g. for Maven dependencies ""


Set an environment variable in the integration container. E.g "env=MY_VAR=my-value"


Add a label to the integration. E.g. ""


The integration name


Add an OpenAPI v2 spec (file path)


Trait profile used for deployment


Add a camel property


Bind a property file to the integration. E.g. ""


Add a resource


Configure a trait. E.g. "trait=service.enabled=false"