如何从cobertura report maven中排除排除java文件

时间:2016-06-27 15:44:31

标签: maven cobertura maven-cobertura-plugin

我的java代码中有一些实用程序类。我想将它从cobertura报告中排除,并在我的pom.xml中添加了exclude标记。但它似乎没有起作用。有没有其他方法可以从报告中排除类或整个包?

  <plugin>
    <groupId>org.codehaus.mojo</groupId>
    <artifactId>cobertura-maven-plugin</artifactId>
    <configuration>
      <instrumentation>
        <excludes>
          <exclude>com/main/class/util*.class</exclude>
        </excludes>
      </instrumentation>
    </configuration>
  </plugin>

1 个答案:

答案 0 :(得分:0)

以上,你必须将它从像这样的报告中排除

   <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>cobertura-maven-plugin</artifactId>
                <version>2.7</version>
                <configuration>

                    <instrumentation>
                        <excludes>
                            <exclude>**/soap/*.class</exclude>                      
                        </excludes>
                    </instrumentation>
                    <check></check>
                    <formats>
                        <format>html</format>
                        <format>xml</format>
                    </formats>
               </configuration>
            </plugin>
        </plugins>
    </build>
    <reporting>
        <plugins>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>cobertura-maven-plugin</artifactId>
                <version>2.7</version>
                <configuration>

                    <instrumentation>
                        <excludes>
                            <exclude>**/soap/*.class</exclude>                      
                        </excludes>
                    </instrumentation>
                    <check></check>
                    <formats>
                        <format>html</format>
                        <format>xml</format>
                    </formats>
               </configuration>
            </plugin>
        </plugins>
    </reporting>
</project>