Skip to content


Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?

Latest commit


Git stats


Failed to load latest commit information.
Latest commit message
Commit time

Contrast Java SDK

javadoc Maven Central

This SDK gives you a quick start for programmatically accessing the Contrast REST API using Java.


  • JDK 1.8
  • Contrast Account

How to use this SDK

  1. Add the contrast-sdk-java dependency from Maven Central to your project.
  2. At a minimum, you will need to supply four basic connection parameters (find them here):


ContrastSDK contrastSDK = new ContrastSDK.Builder("contrast_admin", "demo", "demo")

String orgUuid = contrastSDK.getProfileDefaultOrganizations().getOrganization().getOrgUuid();

Applications apps = contrastSDK.getApplications(orgUuid);
for (Application app : apps.getApplications()) {
    System.out.println(app.getName() + " (" + app.getCodeShorthand() + " LOC)");

Sample output:

Aneritx (48K LOC)
Default Web Site (0k LOC)
EnterpriseTPS (48K LOC)
Feynmann (48K LOC)
jhipster-sample (0k LOC)
JSPWiki (48K LOC)
Liferay (48K LOC)
OpenMRS (65K LOC)
OracleFS (48K LOC)
Security Test (< 1K LOC)
Ticketbook (2K LOC)
WebGoat (48K LOC)
WebGoat7 (106K LOC)


Requires JDK 11 to build

Use ./mvnw verify to build and test changes to the project


To avoid distracting white space changes in pull requests and wasteful bickering about format preferences, Contrast uses the google-java-format opinionated Java code formatter to automatically format all code to a common specification.

Developers are expected to configure their editors to automatically apply this format (plugins exist for both IDEA and Eclipse). Alternatively, developers can apply the formatting before committing changes using the Maven plugin:

./mvnw spotless:apply