SpotBugs 插件
SpotBugs 还有对应的额外插件,用于扩展对应的规则,探测出更多的代码问题。
1.findsecbugs-plugin 追加130条规则
<plugin>
<groupId>com.github.spotbugs</groupId>
<artifactId>spotbugs-maven-plugin</artifactId>
<version>${spotbugs.version}</version>
<configuration>
<plugins>
<plugin>
<groupId>com.h3xstream.findsecbugs</groupId>
<artifactId>findsecbugs-plugin</artifactId>
<version>1.11.0</version>
</plugin>
<plugin>
<groupId>com.mebigfatguy.sb-contrib</groupId>
<artifactId>sb-contrib</artifactId>
<version>7.4.7</version>
</plugin>
</plugins>
</configuration>
</plugin>
2.sb-contrib
最新7.4.7 增加了大致130+条规则
<!-- https://spotbugs.github.io/ -->
<!-- https://spotbugs.github.io/spotbugs-maven-plugin/usage.html -->
<plugin>
<groupId>com.github.spotbugs</groupId>
<artifactId>spotbugs-maven-plugin</artifactId>
<version>${spotbugs.version}</version>
<configuration>
<plugins>
<plugin>
<groupId>com.mebigfatguy.sb-contrib</groupId>
<artifactId>sb-contrib</artifactId>
<version>7.4.7</version>
</plugin>
</plugins>
</configuration>
</plugin>
3.spotbugs配置
<plugin>
<groupId>com.github.spotbugs</groupId>
<artifactId>spotbugs-maven-plugin</artifactId>
<version>${spotbugs.version}</version>
<configuration>
<xmlOutput>true</xmlOutput>
<xmlOutputDirectory>target/site</xmlOutputDirectory>
<!-- <excludeFilterFile>spotbugs-exclude.xml</excludeFilterFile>
<includeFilterFile>spotbugs-include.xml</includeFilterFile>-->
</configuration>
</plugin>
SpotBugs Maven Plugin – spotbugs:check