hudson 集成maven findbugs junit
读这篇blog的前提是你已经装好了 hudson 并且添加了maven findbugs 和junit 插件
hudson版本是2.01
maven版本是3.0.3
findbugs版本是 1.3.9
junit版本是4.5.0
第一步新建项目
第二步配置项目
.......
上一篇blog 说了怎么配置
http://www.cnblogs.com/SXLBlog/archive/2011/06/14/2080270.html
这个版本的findbugs插件是用maven来管理的当然junit也是,这些配置都是放在maven 的配置文件pom.xml当中的 ,
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>findbugs-maven-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<findbugsXmlOutput>true</findbugsXmlOutput>
<findbugsXmlWithMessages>true</findbugsXmlWithMessages>
<xmlOutput>true</xmlOutput>
<findbugsXmlOutputDirectory>target/site</findbugsXmlOutputDirectory>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.4</version>
<scope>test</scope>
</dependency>
</dependencies>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>findbugs-maven-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<findbugsXmlOutput>true</findbugsXmlOutput>
<findbugsXmlWithMessages>true</findbugsXmlWithMessages>
<xmlOutput>true</xmlOutput>
<findbugsXmlOutputDirectory>target/site</findbugsXmlOutputDirectory>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.4</version>
<scope>test</scope>
</dependency>
</dependencies>
这就是在pom.xml 当中配置findbugs 和jnuit 的代码.
<configuration>
<findbugsXmlOutput>true</findbugsXmlOutput>
<findbugsXmlWithMessages>true</findbugsXmlWithMessages>
<xmlOutput>true</xmlOutput>
<findbugsXmlOutputDirectory>target/site</findbugsXmlOutputDirectory>
</configuration>
<findbugsXmlOutput>true</findbugsXmlOutput>
<findbugsXmlWithMessages>true</findbugsXmlWithMessages>
<xmlOutput>true</xmlOutput>
<findbugsXmlOutputDirectory>target/site</findbugsXmlOutputDirectory>
</configuration>
这里配置了findbugs是否输出检查后的文件,上面三条照抄,最后一条根据自己需求修改这是输出的xml的路径,相对于项目根目录..
junit的配置需要注意的是<scope></scope> 这里是作用范围,test 是项目的名称.
这样配置完成之后hudson构建的时候会调用junit 进行测试,但是不会去调用findbugs 这里需要在hudson的任务设置里面配置一下
在Goals and options 中加上maven运行时的命令 clean findbugs:findbugs
这就Ok了,,构建一下就会出现
这些,,上面出现findbugs的检查输出,和modulebuilds 是junit的测试的类,Test Result 是测试结果...