前言
此文件将介绍在IDEA中使用SpotBugs的配置
一、SpotBugs是什么?
官方:https://spotbugs.github.io/
主要用途就是用来查找Java代码中的错误的程序,让我们的编码更加规范.
二、使用步骤
1.引入SpotBugs插件
代码如下(示例):
<build>
<plugin>
<groupId>com.github.spotbugs</groupId>
<artifactId>spotbugs-maven-plugin</artifactId>
<version>4.5.3.0</version>
<executions>
<execution>
<id>check</id>
<phase>package</phase>
<goals>
<goal>check</goal>
</goals>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>com.github.spotbugs</groupId>
<artifactId>spotbugs-annotations</artifactId>
<version>4.6.0</version>
</dependency>
</dependencies>
</plugin>
</build>
2.使用Maven Helper插件
这里是我为了更加方便的执行maven打包等操作,也可以不安装
右键项目,添加命令:spotbugs:gui
这样就可以通过spotbugs提供的工具来图形化解析到时产生的xml报告
3.不使用使用Maven Helper插件
可以在idea的terminal中执行