如何使用Hudson的Maven生成Cobertura代码覆盖率报告

sta*_*wsk 22 hudson cobertura maven

在我的项目中,我需要使用maven build从Hudson创建Cobertura代码覆盖率报告.
在Hudson中,我添加了Cobertura Code Coverage插件.
我需要pom.xml的完整修改步骤.

ewe*_*nli 32

您是否尝试pom.xml在此reporting部分中添加此内容?

<plugin>
    <groupId>org.codehaus.mojo</groupId>
    <artifactId>cobertura-maven-plugin</artifactId>
    <configuration>
       <formats>
           <format>html</format>
           <format>xml</format>
       </formats>
    </configuration>
</plugin>
Run Code Online (Sandbox Code Playgroud)

完整的配置步骤可以在这里找到.


And*_*ght 22

Hudson需要你来生成coverage.xml文件.要在不更改您的情况下执行此操作pom.xml,您可以使用:

mvn cobertura:cobertura -Dcobertura.report.format=xml
Run Code Online (Sandbox Code Playgroud)


Joh*_*rén 7

要在包装阶段运行Cobertura,请执行

 <plugin>  
            <groupId>org.codehaus.mojo</groupId>  
            <artifactId>cobertura-maven-plugin</artifactId>  
            <version>2.5.2</version>  
            <configuration>  
                <formats>  
                    <format>xml</format>  
                </formats>  
            </configuration>  
            <executions>  
                <execution>  
                    <phase>package</phase>  
                    <goals>  
                        <goal>cobertura</goal>  
                    </goals>  
                </execution>  
            </executions>  
   </plugin>         
Run Code Online (Sandbox Code Playgroud)

下面是pom的一个例子

http://macgyverdev.blogspot.com/2011/04/development-environment-for-google-app.html

在这里如何整合Hudson http://macgyverdev.blogspot.com/2011/04/hudson-continous-integration-for-google.html