首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >当maven使用Cobertura报告运行并安装目标时,Cobertura检查失败。

当maven使用Cobertura报告运行并安装目标时,Cobertura检查失败。
EN

Stack Overflow用户
提问于 2014-10-22 14:14:59
回答 1查看 1.9K关注 0票数 2

我在我的pom中设置了以下内容:

代码语言:javascript
复制
...
<build>
...
<plugins>
...
<plugin>
    <groupId>org.codehaus.mojo</groupId>
    <artifactId>cobertura-maven-plugin</artifactId>
    <version>${cobertura-maven-plugin.version}</version>
    <configuration>
        <formats>
            <format>html</format>
        </formats>
        <outputDirectory>${project.build.directory}</outputDirectory>
        <check>
            <haltOnFailure>${testsAreRun}</haltOnFailure>
            <totalBranchRate>27</totalBranchRate>
            <totalLineRate>88</totalLineRate>
        </check>
        <instrumentation>
            <ignoreTrivial>true</ignoreTrivial>
            <excludes>
                <exclude>something/app/**/*.class</exclude>
                <exclude>something/config/**/*.class</exclude>
            </excludes>
        </instrumentation>
    </configuration>
    <executions>
        <execution>
            <phase>verify</phase>
            <goals>
                <goal>clean</goal>
                <!--<goal>cobertura</goal>-->
                <goal>check</goal>
            </goals>
        </execution>
    </executions>
</plugin>
...
<plugins>
...
<build>
...

如果我跑:

代码语言:javascript
复制
mvn clean cobertura:cobertura

一切都很好。如果我跑:

代码语言:javascript
复制
mvn clean install

一切都很好。但是,如果我跑:

代码语言:javascript
复制
mvn clean cobertura:cobertura install

在安装过程中,生成失败,说明我的代码覆盖率为0%,也就是说:

代码语言:javascript
复制
[ERROR] Oct 22, 2014 3:03:59 PM net.sourceforge.cobertura.coveragedata.CoverageDataFileHandler loadCoverageData
INFO: Cobertura: Loaded information on 8 classes.
Project failed check. Total branch coverage rate of 0.0% is below 27.0%
Project failed check. Total line coverage rate of 0.0% is below 88.0%

[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 15.839 s
[INFO] Finished at: 2014-10-22T15:03:59+01:00
[INFO] Final Memory: 38M/469M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.codehaus.mojo:cobertura-maven-plugin:2.6:check (default) on project something: Coverage check failed. See messages above. -> [Help 1]

知道为什么吗?

EN

回答 1

Stack Overflow用户

发布于 2015-08-13 21:36:39

当你跑步时:

mvn卷曲

它刚刚产生了报告。

当你跑的时候

mvn安装

它运行您在那里设置的所有插件,包括您设置的具有行和分支检查的配置。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/26509575

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档