【问题标题】:how to run cobertura during mvn install phase如何在 mvn 安装阶段运行 cobertura
【发布时间】:2014-12-16 01:03:19
【问题描述】:

我为 cobertura 定义了以下插件,如下所示。我必须运行 mvn cobertura:cobertura 才能获得代码覆盖率报告。如何编辑 pom 以便 mvn install 运行 cobertura ?

 <groupId>org.codehaus.mojo</groupId>
            <artifactId>cobertura-maven-plugin</artifactId>
            <version>2.6</version>
            <executions>
                <execution>
                    <phase>install</phase>
                    <goals>
                        <goal>clean</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>

【问题讨论】:

    标签: java maven code-coverage cobertura


    【解决方案1】:

    Cobertura 有自己的生命周期。它按特定顺序执行 cobertura 覆盖报告所需的所有目标。 看 : How do I configure when cobertura tests run in maven-cobertura-plugin?

    唯一的选择是将 cobertura 目标配置为在默认生命周期阶段执行,但由于报告生成目标被假定为作为 Maven 报告运行:

    http://mojo.codehaus.org/cobertura-maven-plugin/cobertura-mojo.html

    IMO 不可能以简单的方式完成(或根本无法完成)。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2016-03-08
      • 1970-01-01
      • 2016-09-10
      • 1970-01-01
      • 1970-01-01
      • 2019-12-10
      • 2013-01-19
      • 2014-12-18
      相关资源
      最近更新 更多