netbeans cobertura报告显示0%的覆盖率

时间:2021-01-15 23:11:51

Set up new maven project with cobertura

与cobertura建立新的maven项目

It runs fine, classes getting instrumented and generates html report

它运行良好,类检测并生成HTML报告

but netbeans shows 0% coverage, the view never refreshes

但netbeans显示0%的覆盖率,视图永远不会刷新

    <cobertura.version>2.1.1</cobertura.version>
    <cobertura.plugin.version>2.7</cobertura.plugin.version>
.........
        <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>cobertura-maven-plugin</artifactId>
            <version>${cobertura.plugin.version}</version>
            <dependencies>
                <dependency>
                    <groupId>net.sourceforge.cobertura</groupId>
                    <artifactId>cobertura</artifactId>
                    <version>${cobertura.version}</version>
                </dependency>
            </dependencies>
            <executions>
                <execution>
                    <goals>
                        <goal>clean</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>

2 个解决方案

#1


Have you included all relevant sections in the sample? Is clean the only goal you are executing? You also need to execute the check goal or the corbetura goal.

您是否已将样本中的所有相关部分包括在内?干净是你执行的唯一目标吗?您还需要执行检查目标或corbetura目标。

Your setup could be made much simpler just by specifying the corbetura plugins and also include the configuration in the reporting section of pom.xml. Follow instructions, refer to http://mojo.codehaus.org/cobertura-maven-plugin/usage.html#

只需指定corbetura插件并在pom.xml的报告部分中包含配置,您的设置就可以变得更加简单。按照说明,参考http://mojo.codehaus.org/cobertura-maven-plugin/usage.html#

#2


Netbeans has problems with cobertura 2.7. I dongraded to cobertura 2.6 and everything started working.

Netbeans与cobertura 2.7有问题。我把它归到了cobertura 2.6,一切都开始了。

#1


Have you included all relevant sections in the sample? Is clean the only goal you are executing? You also need to execute the check goal or the corbetura goal.

您是否已将样本中的所有相关部分包括在内?干净是你执行的唯一目标吗?您还需要执行检查目标或corbetura目标。

Your setup could be made much simpler just by specifying the corbetura plugins and also include the configuration in the reporting section of pom.xml. Follow instructions, refer to http://mojo.codehaus.org/cobertura-maven-plugin/usage.html#

只需指定corbetura插件并在pom.xml的报告部分中包含配置,您的设置就可以变得更加简单。按照说明,参考http://mojo.codehaus.org/cobertura-maven-plugin/usage.html#

#2


Netbeans has problems with cobertura 2.7. I dongraded to cobertura 2.6 and everything started working.

Netbeans与cobertura 2.7有问题。我把它归到了cobertura 2.6,一切都开始了。