Configure the Java agent for Maven Cargo plugin

  • Updated

To configure the Java agent for Maven Cargo plugin:

  1. 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>
  2. Run your Maven target or Cargo unit test as usual.

  3. A Contrast startup message should appear in the console before your server messages appear. (Allow one or two extra minutes for server startup.)

  4. 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.

Was this article helpful?

0 out of 0 found this helpful

Have more questions? Submit a request