我有一个多模块maven项目。我想为网站生成聚合的cobertura报告。运行mvn site
的模块是pom-packaging,所以maven在生成网站时给我这个
[INFO] >>> cobertura-maven-plugin:2.5.1:cobertura (report:cobertura) @ parent >>>
[INFO]
[INFO] --- cobertura-maven-plugin:2.5.1:instrument (report:cobertura) @ parent ---
[INFO] Skipping cobertura mojo for project with packaging type 'pom'
[INFO]
[INFO] <<< cobertura-maven-plugin:2.5.1:cobertura (report:cobertura) @ parent <<<
[INFO] Not executing cobertura:report as the cobertura data file (/home/user/parent/target/cobertura/cobertura.ser) could not be found
相关的pom部分:
...
<reportPlugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>cobertura-maven-plugin</artifactId>
<version>2.5.1</version>
<configuration>
<aggregate>true</aggregate>
</configuration>
</plugin>
</reportPlugins>
...
Cobertura只生成一个空的target/site/cobertura/index.html
文件。有没有办法“强迫”cobertura跑?或者另一种获取汇总报告的方法?
答案 0 :(得分:1)
在您的配置部分中使用:
<forceMojoExecution>true</forceMojoExecution>
答案 1 :(得分:1)
在报告生成中,我们应该启用输出格式html,如下所示。
<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>