【发布时间】:2015-03-04 03:57:25
【问题描述】:
我有一个 maven 多模块项目,我正在使用 jacoco-maven 进行代码覆盖率报告。有些类不应该报告,因为它们是 Spring 配置,我对它们不感兴趣。
我已将 maven-jacoco 插件声明如下:
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.7.2.201409121644</version>
<configuration>
<outputDirectory>${project.reporting.outputDirectory}/jacoco-ut</outputDirectory>
<exclude>some.package.*</exclude>
<exclude>**/*Config.*</exclude>
<exclude>**/*Dev.*</exclude>
<exclude>some/package/SomeClass.java</exclude>
</configuration>
<executions>
<execution>
<goals>
<goal>prepare-agent</goal>
</goals>
</execution>
<execution>
<id>report</id>
<phase>prepare-package</phase>
<goals>
<goal>report</goal>
</goals>
</execution>
<execution>
<id>post-unit-test</id>
<phase>test</phase>
<goals>
<goal>report</goal>
</goals>
</execution>
</executions>
</plugin>
问题是,当我执行mvn clean verify 时,jacoco 仍然报告应该排除的类,正如我的 xml 配置所指出的那样。如何正确配置?
【问题讨论】:
标签: maven configuration jacoco jacoco-maven-plugin