Java Jacoco插件与maven的集成
执行mavenmvn清理安装时发生以下错误 无法执行目标组织。jacoco:jacoco maven插件:0.7.2.201409121644 :准备项目测试的代理默认值NG:goal org.jacoco的执行默认值 :jacoco maven插件:0.7.2.201409121644:准备代理失败:无法加载 插件“org.jacoco:jacocomaven plugin:0.7.2.201409”中的mojo“准备代理” 121644'. 缺少必需的类:org/jacoco/core/runtime/AgentOptions 请找到pomJava Jacoco插件与maven的集成,java,maven,jacoco,Java,Maven,Jacoco,执行mavenmvn清理安装时发生以下错误 无法执行目标组织。jacoco:jacoco maven插件:0.7.2.201409121644 :准备项目测试的代理默认值NG:goal org.jacoco的执行默认值 :jacoco maven插件:0.7.2.201409121644:准备代理失败:无法加载 插件“org.jacoco:jacocomaven plugin:0.7.2.201409”中的mojo“准备代理” 121644'. 缺少必需的类:org/jacoco/core/ru
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.6.3.201306030806</version>
<executions>
<execution>
<id>jacoco-initialize</id>
<phase>initialize</phase>
<goals>
<goal>prepare-agent</goal>
</goals>
</execution>
<execution>
<id>jacoco-site</id>
<phase>package</phase>
<goals>
<goal>report</goal>
</goals>
</execution>
</executions>
</plugin>
尝试使用新版本的jacoco maven插件: 我的发言如下:
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.8.5</version>
<configuration>
<target>
<propertyfile file="lombok.config">
<entry key="config.stopBubbling" value="true" />
<entry key="lombok.addLombokGeneratedAnnotation" value="true" />
</propertyfile>
</target>
<excludes>
<exclude>**/domain/**</exclude>
<exclude>**/enumeration/**</exclude>
<exclude>**/exception/**</exclude>
</excludes>
</configuration>
<executions>
<execution>
<goals>
<goal>prepare-agent</goal>
</goals>
</execution>
<!-- attached to Maven test phase -->
<execution>
<id>report</id>
<phase>test</phase>
<goals>
<goal>report</goal>
</goals>
</execution>
<!-- Add this checking -->
<execution>
<id>jacoco-check</id>
<goals>
<goal>check</goal>
</goals>
<configuration>
<rules>
<rule>
<element>PACKAGE</element>
<limits>
<limit>
<counter>INSTRUCTION</counter>
<value>COVEREDRATIO</value>
<minimum>65%</minimum>
</limit>
</limits>
</rule>
</rules>
</configuration>
</execution>
</executions>
</plugin>
你能检查一下你的pom文件吗?我目前正在成功地使用版本为0.7.4.201502262128的jacoco插件。试试这篇文章可能会有所帮助
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.8.5</version>
<configuration>
<target>
<propertyfile file="lombok.config">
<entry key="config.stopBubbling" value="true" />
<entry key="lombok.addLombokGeneratedAnnotation" value="true" />
</propertyfile>
</target>
<excludes>
<exclude>**/domain/**</exclude>
<exclude>**/enumeration/**</exclude>
<exclude>**/exception/**</exclude>
</excludes>
</configuration>
<executions>
<execution>
<goals>
<goal>prepare-agent</goal>
</goals>
</execution>
<!-- attached to Maven test phase -->
<execution>
<id>report</id>
<phase>test</phase>
<goals>
<goal>report</goal>
</goals>
</execution>
<!-- Add this checking -->
<execution>
<id>jacoco-check</id>
<goals>
<goal>check</goal>
</goals>
<configuration>
<rules>
<rule>
<element>PACKAGE</element>
<limits>
<limit>
<counter>INSTRUCTION</counter>
<value>COVEREDRATIO</value>
<minimum>65%</minimum>
</limit>
</limits>
</rule>
</rules>
</configuration>
</execution>
</executions>
</plugin>