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:
Get the contrast-agent.jar from Maven Central. (See examples of how to download from the Maven repository.)
Configure the agent. You can create or download a YAML configuration file. You must provide Contrast connection parameters using these agent keys.
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
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://pgp.key-server.io.
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 using tools like Pivotal Cloud Foundry (now VMware Tanzu).