【发布时间】:2014-03-11 07:31:48
【问题描述】:
我在 Jenkins 1.502 中有一个带有 jenkins-cobertura 插件版本 1.9.3 的多模块 maven 项目。我的 cobertura.xml 文件是在 web-app 模块中生成的,当我在 Jenkins 中浏览我的项目的工作区时可以看到它。我尝试了多种不同的方法来处理构建后操作中的路径设置以指向 cobertura.xml 文件,但插件一直说找不到它。我得到了错误:
[Cobertura] 使用相对于“C:\Jenkins\jobs\Dev - appName - trunk\workspace”的模式“app/web-app/target/site/cobertura/cobertura.xml”未找到覆盖结果
我的 web 应用程序的 maven pom.xml 在 pom.xml 的部分中设置了 cobertura,如下所示:
<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>
同样在jenkins中,我的maven构建选项如下:
-Pqa clean cobertura:cobertura install
编辑 我发现了我的问题,我将文件命名为“cobertura.xml”而不是“coverage.xml”,或者更好的是使用
**/target/site/cobertura/*.xml
【问题讨论】: