...
Hinweis |
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 (;). |
Codeblock |
|
<plugin>
<groupId>org.apache.camel</groupId>
<artifactId>camel-maven-plugin</artifactId>
<configuration>
<applicationContextUri>META-INF/spring/*.xml;YOUR_FILE_NAME_IN_THE_CLASS_PATH.xml</applicationContextUri>
</configuration>
</plugin>
|
You can also specify what Main class to use when running the plugin. By default this is org.apache.camel.spring.Main
.
Codeblock |
|
<plugin>
<groupId>org.apache.camel</groupId>
<artifactId>camel-maven-plugin</artifactId>
<!-- optional, default value: org.apache.camel.spring.Main -->
<configuration>
<mainClass>mypackage.boot.camel.CamelStartup</mainClass>
</configuration>
</plugin>
|
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.
Codeblock |
|
<plugin>
<groupId>org.apache.camel</groupId>
<artifactId>camel-maven-plugin</artifactId>
<configuration>
<fileApplicationContextUri>
src/main/webapp/WEB-INF/camel*.xml;
src/test/spring/test-context.xml
</fileApplicationContextUri>
</configuration>
</plugin>
|
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.
...
Codeblock |
title |
src/main/resources/log4.properties |
|
log4j.rootLogger=INFO, stdout
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=%-4r [%t] %-5p %c %x - %m%n
log4j.logger.org.apache.camel.impl.DefaultCamelContext=DEBUG, stdout
log4j.additivity.org.apache.camel.impl.DefaultCamelContext=false
|
This should produce a log statement similar to:
Codeblock |
670 [org.apache.camel.spring.Main.main()] DEBUG org.apache.camel.impl.DefaultCamelContext
- Adding routes from: Routes: [Route[ [From[jms:queue:queueA]] -> [To[jms:queue:queueB], To[jms:queue:queueC]]]] routes: []
|
...
For example add the following into your pom
Codeblock |
|
<project>
...
<reporting>
<plugins>
<plugin>
<groupId>org.apache.camel</groupId>
<artifactId>camel-maven-plugin</artifactId>
</plugin>
</plugins>
</reporting>
</project>
|
Then when you run
Codeblock |
|
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.
...