Camel Maven Plugin
The Camel Maven Plugin allows you to run your Enterprise Integration Patterns inside Maven along with being able to support Visualisation maven reports.
The following Goals are supported
Documentation |
Reference |
Description |
---|---|---|
Boots up Camel in a new JVM using the Spring configuration at META-INF/spring/*.xml and runs your routing rules |
||
Boots up Camel in the same JVM as Maven using the Spring configuration at META-INF/spring/*.xml and runs your routing rules |
||
Generates DOT files and then HTML, PNG, SVG files for your EIP routing rules with integration into Maven Reports |
Running your routing rules via camel:run
camel:run is used to run Camel Spring configurations inside Maven for easy testing. A good example application to get you started is the Spring Example.
cd examples/camel-example-spring mvn camel:run
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
META-INF/spring/*.xml
This allows you to boot up any Spring services you wish; whether they are Camel related or any other Spring POJOs.
Running your rules via camel:embedded
camel:embedded works the same as the camel:run above, but it does not fork another JVM, but instead boots up a new ClassLoader and loads the routing rules inside that. So it should startup a bit quicker. Though sometimes we all get the odd classpath issue; so sometimes forking a new JVM can work around any strange Maven classpath issues.
Visualiation Maven Reports
Camel supports Visualisation to be able to turn your Enterprise Integration Patterns into a nice graphical represenation.
If you run the camel:doc plugin it will boot up your CamelContext just like the camel:run plugin but it will only keep up for a few seconds. During that time
it will generate a DOT file generated in target/site/cameldoc. Then this DOT file will be converted nicely into a HTML report.
mvn camel:doc
Your generated PNG/SVG files will then be in the target/site/cameldoc directory.
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.
For example add the following into your pom
<project> ... <reporting> <plugins> <plugin> <groupId>org.apache.camel</groupId> <artifactId>camel-maven-plugin</artifactId> </plugin> </plugins> </reporting> </project>
Then when you run
mvn site
Your context will be booted up via the META-INF/spring/*.xml files, the DOT file generated and a nice HTML report created.