Configure the Java agent for Maven Cargo plugin
To configure the Java agent for Maven Cargo plugin:
Add a
<cargo.jvmargs>
property to the<properties>
section of<configuration>
in your pom.xml. Replace<YourContrastJarPath>
with the path to your Contrast JAR file. For example:<build> <plugins> <plugin> <groupId>org.codehaus.cargo</groupId> <artifactId>cargo-maven2-plugin</artifactId> <version>1.7.3</version> <configuration> <container> <containerId>jetty9x</containerId> [...] </container> <configuration> <properties> <cargo.jvmargs>-javaagent:<YourContrastJarPath></cargo.jvmargs> </properties> </configuration> [...] </configuration> </plugin> </plugins> </build>
Run your Maven target or Cargo unit test as usual.
A Contrast startup message should appear in the console before your server messages appear. (Allow one or two extra minutes for server startup.)
Navigate to your application, and allow an extra minute for startup.
Tip
Learn more about Cargo adding JVM arguments to Cargo container or see an example of how to add the agent to a Maven project.