2015-06-09 57 views
3

Jacoco代码覆盖报告还包括“系统路径罐子”,我用下面的Maven依赖添加类排除的jar文件类从jacoco覆盖报告

<dependency> 
      <groupId>axis</groupId> 
      <artifactId>axis</artifactId> 
      <version>1.2.1</version> 
      <scope>system</scope> 
      <systemPath>${project.basedir}/src/main/resources/lib/axis-1.2.1.jar</systemPath> 
     </dependency> 

我试图排除这个罐子的文件从jacoco插件是这样的:

  <plugin> 
       <groupId>org.jacoco</groupId> 
       <artifactId>jacoco-maven-plugin</artifactId> 
       <version>0.7.2.201409121644</version> 
       <configuration> 
        <excludes> 
         <exclude>**/org/apache/**/*</exclude> 
         <exclude>**/org/globus/**/*</exclude> 
        </excludes> 
       </configuration> 

       <executions> 
        <execution> 
         <id>pre-unit-test</id> 
         <goals> 
          <goal>prepare-agent</goal> 
         </goals> 
         <configuration> 
          <!-- Sets the path to the file which contains the execution data. --> 
          <destFile>${project.build.directory}/coverage-reports/jacoco.exec</destFile> 
          <!-- Sets the name of the property containing the settings for JaCoCo 
           runtime agent. --> 
          <propertyName>surefireArgLine</propertyName> 
         </configuration> 
        </execution> 
        <execution> 
         <id>post-unit-test</id> 
         <phase>test</phase> 
         <goals> 
          <goal>report</goal> 
         </goals> 
         <configuration> 
          <!-- Sets the path to the file which contains the execution data. --> 
          <dataFile>${project.build.directory}/coverage-reports/jacoco.exec</dataFile> 
          <!-- Sets the output directory for the code coverage report. --> 
          <outputDirectory>${project.reporting.outputDirectory}/jacoco</outputDirectory> 
         </configuration> 
        </execution> 
       </executions> 
      </plugin> 

但排除不起作用。它仍然显示jar中包含的文件的覆盖率报告。 如图所示,org.apacke中的文件。 org.clobus。包裹不应该在覆盖率报告中。

enter image description here

+0

我认为排除模式只支持通配符的一些变化。例如。无论从前面:*/**测试*或最后:org/apache/* - 我认为你的模式只应该是“org/apache/**/*”。另一种方法是使用includes,并且只包含你自己的包,因为这可能是一个更短的列表。 – wemu

回答

3

,我发现它的答案

<exclude>**/lib/*</exclude> 

上述排除排除从我的jar文件中的类与system范围。

+0

似乎系统范围的文件结构是基于如何将其放入maven构建中,而不是如何将它作为包视图展开。 – for3st

相关问题