Java Maven 3 cobertura 2.5.1配置

Java Maven 3 cobertura 2.5.1配置,java,jakarta-ee,tdd,maven-3,cobertura,Java,Jakarta Ee,Tdd,Maven 3,Cobertura,我已经在maven 3项目中配置了cobertura。我的需求是在父pom中配置cobertura,并在多个项目的子pom中配置ignore和exclude值。pomxml中的cobutura插件的基本配置与childpom中的cobutura插件的基本配置很好。但当我试图在子pom中配置ignore、排除包并在父pom中添加instrument goal时,我发现插件存在目录问题。谷歌搜索给了我这个链接,但到目前为止还没有成功 以下是我的配置: 父pom: <pluginManagem

我已经在maven 3项目中配置了cobertura。我的需求是在父pom中配置cobertura,并在多个项目的子pom中配置ignore和exclude值。pomxml中的cobutura插件的基本配置与childpom中的cobutura插件的基本配置很好。但当我试图在子pom中配置ignore、排除包并在父pom中添加instrument goal时,我发现插件存在目录问题。谷歌搜索给了我这个链接,但到目前为止还没有成功

以下是我的配置:

父pom:

 <pluginManagement>
    <plugins>
        <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>cobertura-maven-plugin</artifactId>
            <version>2.5.1</version>
            <configuration>
                <check>
                    <haltOnFailure>true</haltOnFailure>
                    <branchRate>50</branchRate>
                    <lineRate>50</lineRate>
                    <haltOnFailure>true</haltOnFailure>
                    <totalBranchRate>50</totalBranchRate>
                    <totalLineRate>50</totalLineRate>
                    <packageLineRate>50</packageLineRate>
                    <packageBranchRate>50</packageBranchRate>
                </check>
            </configuration>
            <executions>  
                <execution>
                    <id>instrument-code</id>
                    <phase>process-classes</phase>
                    <goals>
                      <goal>instrument</goal>
                    </goals>
                </execution>
                <execution>  
                    <id>verify</id>  
                    <phase>verify</phase>  
                    <goals>                             
                      <goal>check</goal>  
                    </goals>  
                </execution> 
            </executions>             
        </plugin>
    </plugins>
 </pluginManagement>
尝试了几种配置,但还没有成功。请给我一些建议


谢谢。

我不明白你为什么在构建部分定义配置,而cobertura主要是一个报告插件。我需要配置cobertura来检查覆盖率并使构建失败。我在这里也看到了类似的情况:这不应该是由CI解决方案生成的,而不是在服务器构建期间生成的。是的,但这个问题与此无关。即使我用这些设置配置CI,也会出现同样的问题。。。我想知道我的插件设置是否正确,以及为什么仪器出现问题。。。或者在子项目中配置忽略/排除设置的更好方法。。。谢谢。我不明白你为什么要在构建部分定义配置,而cobertura主要是一个报告插件。我需要配置cobertura来检查覆盖率并使构建失败。我在这里也看到了类似的情况:这不应该是由CI解决方案生成的,而不是在服务器构建期间生成的。是的,但这个问题与此无关。即使我用这些设置配置CI,也会出现同样的问题。。。我想知道我的插件设置是否正确,以及为什么仪器出现问题。。。或者在子项目中配置忽略/排除设置的更好方法。。。谢谢
<build>
    <plugins>
        <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>cobertura-maven-plugin</artifactId>
            <configuration>
              <instrumentation>
                <ignores>
                  <ignore>to.ignore.*</ignore>
                </ignores>
                <excludes>
                  <exclude>to/exclude/*</exclude>
                </excludes>
              </instrumentation>
            </configuration>
        </plugin>
    </plugins>
 </build>
[ERROR] Failed to execute goal org.codehaus.mojo:cobertura-maven-plugin:2.5.1:instrument (instrument-code) on project test: Unable to prepare instrumentation directory. source and destination are the same directory.