首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >与maven集成的Jacoco插件

与maven集成的Jacoco插件
EN

Stack Overflow用户
提问于 2015-01-22 18:38:53
回答 2查看 4.7K关注 0票数 1

执行maven时发生以下错误(mvn全新安装)

无法在项目testng上执行目标代理:prepare- org.jacoco:jacoco-maven-plugin:0.7.2.201409121644 (默认):执行目标代理的默认值失败:无法加载插件‘org.jacoco :jacoco-org.jacoco- :jacoco-maven-plugin:0.7.2.201409121644:prepare-agent :0.7.2.201409 121644’中的mojo‘prepare-org.jacoco’。缺少必需的类:org/jacoco/core/org/AgentOptions

请找到pom

代码语言:javascript
复制
<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>
EN

回答 2

Stack Overflow用户

发布于 2019-08-18 22:20:00

尝试使用新版本的jacoco-maven-plugin

代码语言:javascript
复制
<plugin>
    <groupId>org.jacoco</groupId>
    <artifactId>jacoco-maven-plugin</artifactId>
    <version>0.8.1</version>
    <executions>
        <execution>
            <goals>
                <goal>prepare-agent</goal>
            </goals>
        </execution>
        <execution>
            <id>report</id>
            <phase>prepare-package</phase>
            <goals>
                <goal>report</goal>
            </goals>
        </execution>
    </executions>
</plugin>
票数 0
EN

Stack Overflow用户

发布于 2020-05-22 02:03:39

我放在下面:

代码语言:javascript
复制
<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>
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/28086675

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档