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:

    <!-- overwrite dependency on spotbugs if you want to specify the version of spotbugs -->

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.