Using the SpotBugs Maven Plugin¶
This chapter describes how to integrate SpotBugs into a Maven project.
Add spotbugs-maven-plugin to your pom.xml¶
Add <plugin> into your pom.xml like below:
<plugin>
<groupId>com.github.spotbugs</groupId>
<artifactId>spotbugs-maven-plugin</artifactId>
<version>3.1.12.2</version>
<dependencies>
<!-- overwrite dependency on spotbugs if you want to specify the version of spotbugs -->
<dependency>
<groupId>com.github.spotbugs</groupId>
<artifactId>spotbugs</artifactId>
<version>4.0.0-RC2</version>
</dependency>
</dependencies>
</plugin>
Goals of spotbugs-maven-plugin¶
spotbugs goal¶
spotbugs goal analyses target project by SpotBugs.
For detail, please refer spotbugs goal description in maven site.
check goal¶
check goal runs analysis like spotbugs goal, and make the build failed if it found any bugs.
For detail, please refer check goal description in maven site.
gui goal¶
gui goal launches SpotBugs GUI to check analysis result.
For detail, please refer gui goal description in maven site.
help goal¶
help goal displays usage of this Maven plugin.