2

我在 maven 3 项目中配置了 cobertura。我的要求是在父 pom 中配置 cobertura 并在多个项目中配置忽略、排除子 pom 中的值。pom xml 中 cobutura 插件的基本配置在子 pom 中引用它工作正常。但是,当我尝试配置忽略、排除子 pom 中的包并在父 pom 中添加仪器目标时,我遇到了插件的目录问题。谷歌搜索给了我这个链接,但到目前为止还没有成功。:http ://blog.bielu.com/2012/01/errata-to-maven2-maven3-migration.html

这是我的配置:

父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>

儿童绒球:

<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.

尝试了几种配置,但还没有运气。请就此给我建议。

谢谢。

4

0 回答 0