我是靠谱客的博主 重要夕阳,最近开发中收集的这篇文章主要介绍maven findbugs插件集成,觉得挺不错的,现在分享给大家,希望可以做个参考。

概述

今天说说maven findbugs插件集成,首先修改工程的pom.xml文件,添加findbugs-maven-plugin插件,如下

  1. <build>  
  2.        <plugins>  
  3.            <plugin>  
  4.               <groupId>org.codehaus.mojo</groupId>  
  5.               <artifactId>findbugs-maven-plugin</artifactId>  
  6.               <version>2.5.1</version>  
  7.               <configuration>  
  8.                   <!-- <configLocation>${basedir}/springside-findbugs.xml</configLocation> -->  
  9.                   <threshold>High</threshold>  
  10.                   <effort>Default</effort>  
  11.                   <findbugsXmlOutput>true</findbugsXmlOutput>  
  12.                    <!-- findbugs xml输出路径-->         <findbugsXmlOutputDirectory>target/site</findbugsXmlOutputDirectory>  
  13.               </configuration>  
  14.            </plugin>  
  15.        </plugins>  
  16.     </build>  



运行findbugs任务前请先运行“mvn package”编译工程
[plain]  view plain copy
  1. mvn findbugs:help       查看findbugs插件的帮助  
  2. mvn findbugs:check      检查代码是否通过findbugs检查,如果没有通过检查,检查会失败,但检查不会生成结果报表  
  3. mvn findbugs:findbugs   检查代码是否通过findbugs检查,如果没有通过检查,检查不会失败,会生成结果报表保存在target/findbugsXml.xml文件中  
  4. mvn findbugs:gui        检查代码并启动gui界面来查看结果  
可以添加findbugs检查规则文件来使用用户自己的规则

[html]  view plain copy
  1. <configuration>  
  2.   <excludeFilterFile>findbugs-exclude.xml</excludeFilterFile>  
  3.   <includeFilterFile>findbugs-include.xml</includeFilterFile>  
  4. </configuration>  
具体fndbugs插件的配置项可以参考 http://mojo.codehaus.org/findbugs-maven-plugin/findbugs-mojo.html

最后

以上就是重要夕阳为你收集整理的maven findbugs插件集成的全部内容,希望文章能够帮你解决maven findbugs插件集成所遇到的程序开发问题。

如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(58)

评论列表共有 0 条评论

立即
投稿
返回
顶部