我想为我的Java8Maven项目创建一个代码覆盖率报告。我在使用Cobertura时遇到了一个问题,因为它不能处理Java 8语法。有人熟悉变通方法吗?还有其他的Maven插件吗?
发布于 2015-10-07 21:56:26
使用在Java8上工作的JaCoCo。
下面是我的pom中的插件XML:
<build>
...
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.7.5.201505241946</version>
<executions>
<execution>
<id>default-prepare-agent</id>
<goals>
<goal>prepare-agent</goal>
</goals>
</execution>
<execution>
<id>default-report</id>
<phase>prepare-package</phase>
<goals>
<goal>report</goal>
</goals>
</execution>
<execution>
<id>default-check</id>
<goals>
<goal>check</goal>
</goals>
<configuration>
<rules><!-- implementation is needed only for Maven 2 -->
<rule implementation="org.jacoco.maven.RuleConfiguration">
<element>BUNDLE</element>
<limits><!-- implementation is needed only for Maven 2 -->
<limit implementation="org.jacoco.report.check.Limit">
<counter>COMPLEXITY</counter>
<value>COVEREDRATIO</value>
<minimum>0.60</minimum>
</limit>
</limits>
</rule>
</rules>
</configuration>
</execution>
</executions>
</plugin>
...
</build>它还与Jenkins等持续集成系统进行了良好的集成
https://stackoverflow.com/questions/32993959
复制相似问题