在pom中引入
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>findbugs-maven-plugin</artifactId>
<version>3.0.0</version>
<configuration>
<!-- 分析工作的等级,可以为Min、Default和Max -->
<effort>Low</effort>
<!-- Low、Medium和High (Low最严格) -->
<threshold>Medium</threshold>
<findbugsXmlOutput>true</findbugsXmlOutput>
<!-- findbugs xml 输出路径 -->
<findbugsXmlOutputDirectory>target/site</findbugsXmlOutputDirectory>
</configuration>
</plugin>
然后运行mvn clean compile findbugs:findbugs
运行成功后在target的site文件夹下有一个findbugsXml的xml文件,里面记载着静态错误信息
如果xml文件不好查看,可以使用 findbugs:gui 的命令进行查看
注意:由于findbugs命令是通过检查字节码文件,所以要先进行编译
最后
以上就是大胆小蘑菇最近收集整理的关于maven工程中使用findbugs插件的全部内容,更多相关maven工程中使用findbugs插件内容请搜索靠谱客的其他文章。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复