Skip to main content

Using the Sonatype CLI with a CI Server

In your continuous integration (CI) server, identify the location for adding a build step that includes processing a simple shell script during the build stage.

Execute a script call to the Sonatype CLI using the following syntax, from that location:

java -jar [ScannerJar] \
  -i [AppID] \
  -e [IgnoreSystemErrors] \
  -w [FailOnPolicyWarning] \
  -s [ServerURL] \
  -a [username:password] \
  [Target]

Given a typical setup, your syntax, including all available options, will likely look similar to the following:

java -jar nexus-iq-cli*.jar \
  -a username:password \
  -i tester123 \
  -s http://localhost:8070 \
  ./target/sample-app.war

When your application is built, the build step you have added will call the Sonatype CLI, evaluate your application, and upload the results of the evaluation to the IQ Server. By default, this will be placed below the build column in the Reports and Application area on the IQ Server, for your application.

Note

We recommend using a separate application identifier for each of your applications. Using the same application identifier will result in report results being overwritten each time an application is built.