<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.8.0</version>
<configuration>
<!-- remove haltOnFailure to purposely fail build once we recover coverage back to 70% -->
<haltOnFailure>false</haltOnFailure>
<rules>
<rule>
<element>CLASS</element>
<limits>
<limit>
<counter>LINE</counter>
<value>COVEREDRATIO</value>
<minimum>0.70</minimum>
</limit>
<limit>
<counter>BRANCH</counter>
<value>COVEREDRATIO</value>
<minimum>0.70</minimum>
</limit>
</limits>
<excludes>
<!-- exclude domain objects -->
<exclude>com/path/to/classes/**/*</exclude>
</excludes>
</rule>
</rules>
</configuration>
<executions>
<execution>
<id>default-prepare-agent</id>
<goals>
<goal>prepare-agent</goal>
</goals>
</execution>
<execution>
<id>check</id>
<goals>
<goal>check</goal>
<goal>report</goal>
</goals>
<phase>verify</phase>
</execution>
</executions>
</plugin>
</plugins>
预期行为:目标/网站/ jacoco / index.html上的HTML报告不包含com / path / to / classes的行
实际行为:目标/网站/ jacoco / index.html上的HTML报告包含com / path / to / classes的行,这会导致将报告报告为(在我的情况下) 32%,证明此套餐包含且不应。
我一定做错了什么?
答案 0 :(得分:2)
您可以在configuration
的{{1}}节点上检测/分析/报告完全排除文件
excludes
<configuration>
<excludes>
com/path/to/classes/**/*
</excludes>
</configuration>
节点上指定的排除忽略仅为该规则排除的类