This makes it very easy to spin up and test your routing rules without having to write a main(…) method; it also lets you create multiple jars to host different sets of routing rules and easily test them independently.
How this works is that the plugin will compile the source code in the maven project, then boot up a Spring ApplicationContext using the XML confiuration files on the classpath at
If you want to boot up your Camel routes a little faster, you could try the camel:embedded instead.
Running OSGi Blueprint
From Camel 2.10 onwards the
camel:run plugin also supports running a Blueprint application, and by default it scans for OSGi blueprint files in
You would need to configure the camel:run plugin to use blueprint, by setting useBlueprint to true as shown below
This allows you to boot up any Blueprint services you wish - whether they are Camel-related, or any other Blueprint.
From Camel 2.17 onwards the camel:run goal is able to auto detect if camel-blueprint is on the classpath or there is blueprint XML files in the project, and therefore you no longer have to configure the useBlueprint option.
Using limited Blueprint container
You can use the
applicationContextUri configuration to specify an explicit blueprint XML file, such as:
applicationContextUri will currently load the file from the classpath, so in the example above the myBlueprint.xml file must be in the root of the classpath.
configAdminPid is the pid name which will be used as the pid name for configuration admin service when loading the persistence properties file.
configAdminFileName is the file name which will be used to load the configuration admin service properties file.
From Camel 2.11 onwards the
camel:run plugin also supports running a CDI application
You would need to configure the camel:run plugin to use CDI, by setting useCDI to true as shown below
This allows you to boot up any CDI services you wish - whether they are Camel-related, or any other CDI enabled services.
You should add the CDI container of your choice (e.g. Weld or OpenWebBeans) to the dependencies of the camel-maven-plugin such as in this example.
From Camel 2.17 onwards the camel:run goal is able to auto detect if camel-cdi in on the classpath, and therefore you no longer have to configure the useCDI option.
From the source of Camel you can run a CDI example via
Logging the classpath
From Camel 2.10 onwards you can configure whether the classpath should be logged when
camel:run executes. In older releases the classpath is always logged.
This can be verbose and noisy, so from Camel 2.10 onwards, the classpath is not logged anymore. You can enable this in the configuration using:
Using live reload of XML files
From Camel 2.19 onwards you can configure the plugin to scan for XML file changes and trigger a reload of the Camel routes which are contained in those XML files.
Then the plugin watches this directory. This allows you to edit the source code from your editor and save the file, and have the running Camel application pickup those changes.
Notice its only changes of Camel routes, eg
<route> which is supported. You cannot change Spring or OSGi Blueprint