Camel Maven Plugin

The Camel Maven Plugin allows you to run your Enterprise Integration Patterns using Spring for Dependency Injection inside Maven along with being able to support Visualisation along with integration of the Visualisation diagrams into the standard maven reports for your project.

Goals Supported

Documentation

Goal

Description

camel:run

camel:run

Boots up Camel in the context of a separately initiated Java thread using the Spring configuration at META-INF/spring/*.xml and runs your routing rules. From Camel 2.10 onwards also OSGi blueprint is supported to load from OSGI-INF/blueprint/*.xml (requires to configure the plugin to use blueprint).

camel:embedded

camel:embedded

Boots up Camel using the Spring configuration at META-INF/spring/*.xml and runs your routing rules. From Camel 2.10 onwards also OSGi blueprint is supported to load from OSGI-INF/blueprint/*.xml (requires to configure the plugin to use blueprint).

camel:dot

camel:dot

deprecated: Generates DOT files and then HTML, PNG, SVG files for your EIP routing rules with integration into Maven Reports. This plugin only supports Spring XML files.

Adding the plugin to your pom.xml

Add the following in your <build><plugins> section

Icon

You may override the default Spring application context file uri META-INF/spring/*.xml by using the applicationContextUri property in the camel-maven-plugin configuration. Paths may be split using a semi-colon (;).

You can also specify what Main class to use when running the plugin. By default this is org.apache.camel.spring.Main.

 

File based spring configuration files

From Camel 1.4 onwards loading Spring context files via a file location is also supported. You configure this with the fileApplicationContextUri option. Paths may be split using a semi-colon (;). This sort of file location is useful for web application projects that store spring configuration files in WEB-INF. It can also be used to replace configuration that requires an OSGi container with an equivalent non-OSGi configuration.

Classpath

The plugin will construct a classpath of any Maven dependency with scope "compile". The classpath is output as an INFO log statement upon startup.

Route Information

Information about the generated routes is available through the GraphViz report, and also through the log statements generated by the run goal. If you would like to see this information then add a log4j (or other commons-logging implementation) config file with the following levels.

src/main/resources/log4.properties

This should produce a log statement similar to:

Integration into Maven Reports

If you add the camel-maven-plugin to your <reporting> section of your pom you will automatically get the Visualisation reporting generated for your project as part of the regular maven site generation.

For example add the following into your pom

Then when you run

Your context will be booted up via the META-INF/spring/*.xml files, the DOT file generated and a nice HTML report created.

GraphViz DOT required

Icon

Note to get the nice HTML, PNG and SVG outputs from the DOT files you will need to install the GraphViz DOT executable and add it to your PATH so that the plugin can invoke DOT to generate the PNG/SVG files.

For more details see the camel:dot.

© 2004-2014 The Apache Software Foundation.
Apache Camel, Camel, Apache, the Apache feather logo, and the Apache Camel project logo are trademarks of The Apache Software Foundation. All other marks mentioned may be trademarks or registered trademarks of their respective owners.
Graphic Design By Hiram