Our website uses cookies to enhance your browsing experience.
Accept
to the top
>
>
PVS-Studio Java quick start
menu mobile close menu
Additional information
toggle menu Contents

PVS-Studio Java quick start

May 05 2026

This documentation covers the quick start of Java project analysis using plugins for the build systems Gradle and Maven.

PVS-Studio Java also provides integration with the IntelliJ IDEA IDE via a special plugin, and integration with Visual Studio Code via a special extension. Learn more from the documentation:

PVS-Studio quick start via Gradle

Integration into the project via the build script

To integrate the plugin into a project using Groovy DSL, add the following code to the build.gradle script:

buildscript {
  repositories {
    mavenCentral()
    maven {
      url uri('https://cdn.pvs-studio.com/java/pvsstudio-maven-repository/')
    }
  }
  dependencies {
    classpath 'com.pvsstudio:pvsstudio-gradle-plugin:latest.release'
  }
}
apply plugin: com.pvsstudio.PvsStudioGradlePlugin
pvsstudio {
  outputType = 'json'
  outputFile = '.PVS-Studio/report.json'
  analysisMode = ['GA', 'OWASP']
}

For Kotlin DSL, add the following code to build.gradle.kts:

import com.pvsstudio.WarningGroup

buildscript {
  repositories {
    mavenCentral()
    maven {
      url =
        uri("https://cdn.pvs-studio.com/java/pvsstudio-maven-repository/")
    }
  }
  dependencies {
    classpath("com.pvsstudio:pvsstudio-gradle-plugin:latest.release")
  }
}

apply<com.pvsstudio.PvsStudioGradlePlugin>()

extensions.configure<com.pvsstudio.AnalyzerConfig>("pvsstudio") {
  outputType = "json"
  outputFile = ".PVS-Studio/report.json"
  analysisMode = setOf(WarningGroup.GA, WarningGroup.OWASP)
}

Running the analysis

Before running the analysis, enter the license and activate it using the following command:

./gradlew pvsCredentials "-Ppvsstudio.userName=${USER_NAME}" \
                         "-Ppvsstudio.licenseKey=${LICENSE_KEY}"

Replace the USER_NAME variable with the analyzer user name tied to the key, and replace LICENSE_KEY with the license key.

Now you can run the analysis by using the following command:

./gradlew pvsAnalyze

Note: when checking a project, the plugin runs the Java analyzer core, which by default uses the Java version from the PATH environment variable. You can specify a different version using the plugin's javaPath setting. More details are available in the documentation.

PVS-Studio quick start via Maven

Integration via the configuration file

To integrate the plugin into the project, add the following code to the pom.xml file:

<pluginRepositories>
  <pluginRepository>
    <id>pvsstudio-maven-repo</id>
    <url>https://cdn.pvs-studio.com/java/pvsstudio-maven-repository/</url>
  </pluginRepository>
</pluginRepositories>
<build>
  <plugins>
    <plugin>
      <groupId>com.pvsstudio</groupId>
      <artifactId>pvsstudio-maven-plugin</artifactId>
      <version>7.42.105102</version>
      <configuration>
        <analyzer>
          <outputType>json</outputType>
          <outputFile>.PVS-Studio/report.json</outputFile>
          <analysisMode>GA, OWASP</analysisMode>
        </analyzer>
      </configuration>
    </plugin>
  </plugins>
</build>

Running the analysis

Before running the analysis, enter the license and activate it using the following command:

mvn pvsstudio:pvsCredentials "-Dpvsstudio.userName=${USER_NAME}" \
                             "-Dpvsstudio.licenseKey=${LICENSE_KEY}"

Replace the USER_NAME variable with the analyzer user name tied to the key, and replace LICENSE_KEY with the license key.

Now you can run the analysis by using the following command:

mvn pvsstudio:pvsAnalyze

Note: when checking a project, the plugin runs the Java analyzer core, which by default uses the Java version from the PATH environment variable. You can specify a different version using the plugin's javaPathsetting. More details are available in the documentation.

Running analysis without integration into the build script

You can analyze Maven projects without modifying the pom.xml file. In this case, the analysis starts by running the following command in the project directory:

For PowerShell:

$repo = "https://files.pvs-studio.com/java/pvsstudio-maven-repository/"

mvn -f ./pom.xml `
 "-Dmaven.repo.remote= $repo" `
 "-Dmaven.test.skip=true" `
 "-Dpvsstudio.outputType=json" `
 "-Dpvsstudio.outputFile=.PVS-Studio/report.json" `
 "-Dpvsstudio.analysisMode=GA,OWASP" `
 com.pvsstudio:pvsstudio-maven-plugin:7.42.105102:pvsAnalyze

For Bash:

repo=https://files.pvs-studio.com/java/pvsstudio-maven-repository/ 

mvn -f ./pom.xml \
 -Dmaven.repo.remote= "$repo" \
 -Dmaven.test.skip=true \
 -Dpvsstudio.outputType=json \
 -Dpvsstudio.outputFile=.PVS-Studio/report.json \
 -Dpvsstudio.analysisMode=GA,OWASP \
 com.pvsstudio:pvsstudio-maven-plugin:7.42.105102:pvsAnalyze

For cmd:

set REPO=https://files.pvs-studio.com/java/pvsstudio-maven-repository/

mvn -f ./pom.xml ^
 "-Dmaven.repo.remote=%REPO%" ^
 "-Dmaven.test.skip=true" ^
 "-Dpvsstudio.outputType=json" ^
 "-Dpvsstudio.outputFile=.PVS-Studio/report.json" ^
 "-Dpvsstudio.analysisMode=GA,OWASP" ^
 com.pvsstudio:pvsstudio-maven-plugin:7.42.105102:pvsAnalyze

Handling analysis results

Once the analysis is complete, a file named report.json—containing PVS-Studio Java analyzer warnings—is created in the .PVS-Studio directory at the project root.

You can review the report results using:

Report conversion

You can generate the PVS-Studio analyzer report in various formats. To convert it from one supported format to another, use the PlogConverter utility. It is included in the PVS-Studio distribution. One of the supported output formats is FullHTML. It enables you to view the analyzer report in a browser, sort warnings, and view the source code snippet that triggered the analyzer warning.

By default, the utility is located in the root analyzer directory. To convert the report, run the following command in the directory that contains the json report:

For PowerShell:

& "C:\Program Files (x86)\PVS-Studio\PlogConverter.exe" `
   -t FullHtml `
   -a "GA:1,2,3;OWASP:1,2,3" `
   -o . `
   report.json

For Bash:

plog-converter \
 -t FullHtml \
 -a GA:1,23;OWASP:1,2,3 \
 -o . \
 report.json

For cmd:

"C:\Program Files (x86)\PVS-Studio\PlogConverter.exe" ^
 -t FullHtml ^
 -a GA:1,2,3;OWASP:1,2,3 ^
 -o . ^
 report.json

As a result, the utility creates a fullhtml directory containing a set of files that form a web page with the analyzer report. To view it, open the index.html file in your browser.

Links

Learn more about working with PVS-Studio Java via the Gradle and Maven build systems in the documentation sections: