【问题标题】:cobertura on pom-packaging modulepom-packaging 模块上的 cobertura
【发布时间】:2012-02-05 04:23:31
【问题描述】:

我有一个多模块 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 跑?或者以其他方式获取我的汇总报告?

【问题讨论】:

  • forceMoojoExecution 似乎不起作用。有解决办法吗?

标签: maven maven-plugin cobertura


【解决方案1】:

在您的配置部分使用:

 <forceMojoExecution>true</forceMojoExecution>

【讨论】:

    【解决方案2】:

    在报告生成中,我们应该启用输出格式 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>
    

    【讨论】:

      猜你喜欢
      • 2020-12-09
      • 1970-01-01
      • 1970-01-01
      • 2017-07-21
      • 1970-01-01
      • 2010-11-28
      • 2013-09-12
      • 2010-12-31
      • 2017-02-23
      相关资源
      最近更新 更多