我们有一个多项目,我们正在尝试运行Cobertura测试报告作为我们mvn站点构建的一部分。我可以让Cobertura运行在子项目上,但是它错误地报告了0%的覆盖率,尽管报告仍然突出显示了单元测试打击的代码行。Maven2多项目Cobertura在mvn站点构建过程中报告问题
我们使用的是mvn 2.0.8。我试过运行mvn clean site
,mvn clean site:stage
和mvn clean package site
。我知道测试正在运行,它们在肯定的报告中显示(包括txt/xml和站点报告)。我在配置中丢失了什么吗? Cobertura不适用于多项目吗?
这是在父.pom:
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>cobertura-maven-plugin</artifactId>
<inherited>true</inherited>
<executions>
<execution>
<id>clean</id>
<goals>
<goal>clean</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</pluginManagement>
</build>
<reporting>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>cobertura-maven-plugin</artifactId>
<inherited>true</inherited>
</plugin>
</plugins>
</reporting>
我试着和没有孩子.poms以下运行它:
<reporting>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>cobertura-maven-plugin</artifactId>
</plugin>
</plugins>
</reporting>
我的输出得到这个编译:
...
[INFO] [cobertura:instrument]
[INFO] Cobertura 1.9 - GNU GPL License (NO WARRANTY) - See COPYRIGHT file
Instrumenting 3 files to C:\workspaces\sandbox\CommonJsf\target\generated-classes\cobertura
Cobertura: Saved information on 3 classes.
Instrument time: 186ms
[INFO] Instrumentation was successful.
...
[INFO] Generating "Cobertura Test Coverage" report.
[INFO] Cobertura 1.9 - GNU GPL License (NO WARRANTY) - See COPYRIGHT file
Cobertura: Loaded information on 3 classes.
Report time: 481ms
[INFO] Cobertura Report generation was successful.
,报告如下: cobertura report http://trandem.com/images/cobertura.png
男人,你需要一个新的显示器!我几乎读不出那些类名。 – 2008-09-18 23:27:41