7
Maven Jacoco配置-从报告中排除类/程序包不起作用
我有一个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 verifyjacoco时,仍然报告应删除的类,因为我的xml配置指出了这些类。如何正确配置?