Skip to main content

Install the Java agent using Maven Central

The Contrast Java agent is available from Maven Central using group ID com.contrastsecurity and artifact ID contrast-agent. To install the Java agent:

  1. Get the contrast-agent.jar from Maven Central. (See examples of how to download from the Maven repository.)

    The latest Contrast Java agent is available for download directly from https://download.java.contrastsecurity.com/latest.

  2. Configure the agent. You can create or download a YAML configuration file. You must provide Contrast connection parameters using these agent keys.

  3. Tell the agent where to find the yaml configuration file (contrast.yaml). In the example below, substitute <YourContrastJarPath> with the path to your Contrast JAR (this may vary depending on your internal file structure and how you downloaded the file) and <ApplicationJar> with the name of your application JAR.

    java -javaagent:<YourContrastJarPath> -Dcontrast.config.path=contrast.yaml -jar <ApplicationJar>.jar

    Note

    If you are using system properties, environment variables to configure instead of YAML, or you have placed the YAML in a standard location where the agent can find it automatically, set the JVM parameter to include the Java agent.

    java -javaagent:<YourContrastJarPath> -jar <AppName>.jar
  4. Use the application as you normally would (for example, click on the web interface, send API commands). Verify that Contrast sees your application (for example, view your application in the Contrast web interface, view logs).

Contrast artifacts deployed to Maven Central are signed with our GPG key hosted on https://keyserver.ubuntu.com. Contrast's public signing key has ID 1AAD9AFB3FC5CCA6940D021534D84B137E8F1053 and can be installed to a local keyring with the following command:

gpg --keyserver keyserver.ubuntu.com --recv-keys 1AAD9AFB3FC5CCA6940D021534D84B137E8F1053

You can also provide security analysis for applications running in a test/QA or production environment, by installing the agent with an application server like:

You can also install using a container, like Docker.

Tip

Check the Contrast Support Portal for more information about other compatible ways to install the agent. If you are using VMware Tanzu, see the details in Java installation with VMware Tanzu.