Configure the Java agent for Apache Tomcat Maven plugin

To configure the Java agent for the Apache Tomcat Maven plugin:

If you're forking your JVM, replace <YourContrastJarPath> with the path to your Contrast JAR and set your MAVEN_OPTS environment variable to contain Contrast's JVM parameters:

  • Windows:

    set MAVEN_OPTS=-javaagent:<YourContrastJarPath>
    mvn -Dmaven.tomcat.port=8181 clean package tomcat9:run-war
  • Linux:

    export MAVEN_OPTS="-javaagent:<YourContrastJarPath>"
    mvn -Dmaven.tomcat.port=8181 clean package tomcat9:run-war

If you are not forking your JVM, replace <YourContrastJarPath> with the path to your Contrast JAR and set the mvn command to use the following JVM parameters:

-javaagent:<YourContrastJarPath>

Run with the tomcat9:run-war or other Maven goal.

Note

Library analytics won't be collected if you choose a goal besides run-war.

A Contrast startup message should appear in the Console. (Allow one to two extra minutes for server startup.) Navigate to your application, and allow an extra minute for it to start up.