Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Next »

The Camel Maven Plugin will support the following goals:

  • camel:run - To run your Camel application

  • camel:dev - To run your Camel application in developer mode

  • camel:prepare-fatjar - To prepare your Camel application for being packaged as a fat-jar (such as by maven-assembly-plugin)

camel:run

The goal of the Camel Maven Plugin is used to run your Camel Spring configurations in a forked JVM from Maven. A good example application to get you started is the Spring Example:

cd examples/camel-example-spring
mvn camel:run

This approach makes it easy to start and test your routing rules without the added aspect of having to write a main(…​) method. Additionally, it also lets you create multiple jars to host different sets of routing rules and easily test them independently.

The Camel Maven plugin compiles the source code in the Maven project, then boots up a Spring ApplicationContext using the XML configuration files on the classpath at META-INF/spring/*.xml

camel:run Options

The plugin run goal supports the following options which can be configured from the command line (use -D syntax), or defined in the pom.xml file in the <configuration> tag.

Parameter

Default Value

Description

duration

-1

Sets the time duration (seconds) that the application runs for before terminating.

NOTE: A value = 0 will run forever.

durationIdle

-1

Sets the idle time duration (seconds) duration that the application can be idle for before terminating.

NOTE: A value = 0 will run forever.

durationMaxMessages

-1

Sets the duration of maximum number of messages that the application processes before terminating.

logClasspath

false

Boolean on whether to log the classpath when starting

camel:validate

For validating the source code for misconfigured Camel: * endpoint URIs * simple expressions or predicates * duplicate route ids. We can run the camel:validate goal from the command line or from within your Java editor such as IDEA or Eclipse.

mvn camel:validate

Or, enable the plugin to automatic run as part of the build to catch these errors:

<plugin>
  <groupId>....</groupId>
  <artifactId>camel-maven-plugin</artifactId>
  <executions>
    <execution>
      <phase>process-classes</phase>
      <goals>
        <goal>validate</goal>
      </goals>
    </execution>
  </executions>
</plugin>

Run camel:validate on Maven Project

We are also able to run the validate goal on any Maven project without having to add the plugin to the pom.xml file. However, doing so requires specifying the plugin using its fully qualified name. For example:

$cd camel-example-cdi
$mvn org.apache.camel:camel-maven-plugin:2.20.0:validate

Which would return the following:

[INFO] ------------------------------------------------------------------------
[INFO] Building Camel :: Example :: CDI 2.20.0
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- camel-maven-plugin:2.20.0:validate (default-cli) @ camel-example-cdi ---
[INFO] Endpoint validation success: (4 = passed, 0 = invalid, 0 = incapable, 0 = unknown components)
[INFO] Simple validation success: (0 = passed, 0 = invalid)
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------

camel:validate Options

The Camel Maven plugin validate goal supports the following options which can be configured from the command line (use -D syntax), or defined in the pom.xml file in the <configuration> tag.

  • No labels