Maven Jenkins Cobertura插件找不到coverage.xml文件
我在Jenkins 1.502中有一个多模块maven项目,带有Jenkins cobertura插件版本1.9.3。我的cobertura.xml文件是在web应用程序模块中生成的,当我在Jenkins中浏览项目的工作区时可以看到它。我尝试了多种不同的方法来接近构建后操作中的路径设置,以指向cobertura.xml文件,但插件一直说它找不到它。我得到一个错误: [Cobertura]使用模式“app/web app/target/site/Cobertura/Cobertura.xml”相对于“C:\Jenkins\jobs\Dev-appName-trunk\workspace”未找到覆盖率结果 web应用程序的My maven pom.xml在pom.xml部分中设置了cobertura,如下所示:Maven Jenkins Cobertura插件找不到coverage.xml文件,maven,jenkins,cobertura,Maven,Jenkins,Cobertura,我在Jenkins 1.502中有一个多模块maven项目,带有Jenkins cobertura插件版本1.9.3。我的cobertura.xml文件是在web应用程序模块中生成的,当我在Jenkins中浏览项目的工作区时可以看到它。我尝试了多种不同的方法来接近构建后操作中的路径设置,以指向cobertura.xml文件,但插件一直说它找不到它。我得到一个错误: [Cobertura]使用模式“app/web app/target/site/Cobertura/Cobertura.xml”相对
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>cobertura-maven-plugin</artifactId>
<version>2.5.1</version>
<configuration>
<formats>
<format>xml</format>
<format>html</format>
</formats>
<instrumentation>
<excludes>
<exclude>**/*Test.class</exclude>
<exclude>**/Mock*.class</exclude>
</excludes>
</instrumentation>
</configuration>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>cobertura</goal>
</goals>
</execution>
</executions>
</plugin>
org.codehaus.mojo
cobertura maven插件
2.5.1
xml
html
**/*测试类
**/模拟*.class
包裹
科贝图拉
同样在jenkins中,我的maven构建选项如下:
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>cobertura-maven-plugin</artifactId>
<version>2.5.1</version>
<configuration>
<formats>
<format>xml</format>
<format>html</format>
</formats>
<instrumentation>
<excludes>
<exclude>**/*Test.class</exclude>
<exclude>**/Mock*.class</exclude>
</excludes>
</instrumentation>
</configuration>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>cobertura</goal>
</goals>
</execution>
</executions>
</plugin>
-Pqa清洁cobertura:安装cobertura
编辑
我发现了我的问题,我将文件命名为“cobertura.xml”,而不是“coverage.xml”,或者更好的方法是用
**/target/site/cobertura/*.xml
以xml或html格式输出的cobertura
<formats>
<format>xml</format>
</formats>
xml
并确保结果(coverage.xml)在此目录中可用,$JENKINS_HOME/workspace/.job../app/web app/target/site/cobertura/coverage.xml文件
或检查cobertura报告的目标目录
或者抓取一个示例文件,然后尝试..将其放在作业目录下并查看其工作原理..在应用程序目标中添加以下行(在jenkins中配置应用程序部分): pom.xml更改:
<reporting>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>cobertura-maven-plugin</artifactId>
<version>2.6</version>
<configuration>
<formats>
<format>html</format>
<format>xml</format>
</formats>
</configuration>
</plugin>
</plugins>
</reporting>
org.codehaus.mojo
cobertura maven插件
2.6
html
xml
额外的html格式不会绊倒jenkins cobertura插件。至少对我来说不是。