Maven cobertura:检查似乎缺少参数

Maven cobertura:检查似乎缺少参数,maven,cobertura,maven-cobertura-plugin,Maven,Cobertura,Maven Cobertura Plugin,我正在使用cobertura和Maven生成代码覆盖率报告。我们希望在测试用例没有覆盖足够的代码时,能够使构建失败。基于maven cobertura插件,我将pom文件配置为: <build> <plugins> <plugin> <artifactId>maven-compiler-plugin</artifactId> <version>2.3.2

我正在使用cobertura和Maven生成代码覆盖率报告。我们希望在测试用例没有覆盖足够的代码时,能够使构建失败。基于maven cobertura插件,我将pom文件配置为:

<build>
    <plugins>
        <plugin>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>2.3.2</version>
            <configuration>
                <source>1.6</source>
                <target>1.6</target>
            </configuration>
        </plugin>
        <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>cobertura-maven-plugin</artifactId>
            <version>2.6</version>
            <configuration>
                <check>
                    <branchRate>85</branchRate>
                    <lineRate>85</lineRate>
                    <haltOnFailure>true</haltOnFailure>
                    <totalBranchRate>85</totalBranchRate>
                    <totalLineRate>85</totalLineRate>
                    <packageLineRate>85</packageLineRate>
                    <packageBranchRate>85</packageBranchRate>
                </check>
            </configuration>
            <executions>
                <execution>
                    <goals>
                        <goal>clean</goal>
                        <goal>check</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>
    </plugins>
</build>
<reporting>
    <plugins>
        <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>cobertura-maven-plugin</artifactId>
            <version>2.6</version>
        </plugin>
    </plugins>
</reporting>
我没有看到任何明显的错误,所以我不确定为什么我不能运行
检查

我正在从RAD 8.5运行嵌入式版本的Maven,使用运行配置,目标如下:

清洁cobertura:检查

如果我以

清洁科伯图拉:科伯图拉

检查过程没有运行,构建成功,尽管我知道我的覆盖率不到85%


有人知道cobertura有什么问题吗?
check
以及我如何让它工作?

看来正确的方法是调用Maven,目标是:
clean verify site

在plugins标签内的pom.xml中使用以下内容

<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>
                <executions>
                    <execution>
                        <phase>package</phase>
                        <goals>
                            <goal>cobertura</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

org.codehaus.mojo
cobertura maven插件
2.6
html
xml
包裹
科贝图拉
并在pom.xml的项目标记中使用以下内容

<reporting>
        <plugins>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>cobertura-maven-plugin</artifactId>
                <version>2.6</version>
            </plugin>
        </plugins>
    </reporting>

org.codehaus.mojo
cobertura maven插件
2.6
这对我有用

<reporting>
        <plugins>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>cobertura-maven-plugin</artifactId>
                <version>2.6</version>
            </plugin>
        </plugins>
    </reporting>