Jacoco Maven插件-生命周期配置未涵盖插件执行 [英] Jacoco Maven Plugin - Plugin execution not covered by lifecycle configuration

查看:71
本文介绍了Jacoco Maven插件-生命周期配置未涵盖插件执行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是Maven的新手,并且想使用Jacoco Maven插件来构建我的项目.

I'm new to Maven and want to use the Jacoco Maven Plugin to build my projects.

我已经建立了一个带有TestNG唯一依赖项的示例项目.

I've set up an example project with TestNG the only dependency.

这是pom.xml的一部分:

Here is part of the pom.xml:

<dependencies>
    <dependency>
        <groupId>org.testng</groupId>
        <artifactId>testng</artifactId>
        <version>6.8</version>
    </dependency>
</dependencies>
<build>
    <plugins>
        <plugin>
            <groupId>org.jacoco</groupId>
            <artifactId>jacoco-maven-plugin</artifactId>
            <version>0.6.2.201302030002</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>
    </plugins>
</build>

我得到这个错误:

生命周期配置未涵盖插件执行:org.jacoco:jacoco-maven- 插件:0.6.2.201302030002:准备代理(执行:默认,阶段:初始化)

Plugin execution not covered by lifecycle configuration: org.jacoco:jacoco-maven- plugin:0.6.2.201302030002:prepare-agent (execution: default, phase: initialize)

我在做什么错? 干杯

推荐答案

您可以忽略插件目标,在pom.xml中添加类似内容

You can ignore the plugin goal, adding something like this to your pom.xml

<pluginManagement>
        <plugins>
            <!--This plugin's configuration is used to store Eclipse m2e settings only.
                It has no influence on the Maven build itself.-->
            <plugin>
                <groupId>org.eclipse.m2e</groupId>
                <artifactId>lifecycle-mapping</artifactId>
                <version>1.0.0</version>
                <configuration>
                    <lifecycleMappingMetadata>
                        <pluginExecutions>
                            <pluginExecution>
                                <pluginExecutionFilter>
                                    <groupId>org.jacoco</groupId>
                                    <artifactId>jacoco-maven-plugin</artifactId>
                                    <versionRange>[0.5,)
                                    </versionRange>
                                    <goals>
                                        <goal>prepare-agent</goal>
                                    </goals>
                                </pluginExecutionFilter>
                                <action>
                                    <!-- m2e doesn't know what to do with jacoco,
                                        let's ignore it or annoying error markers appear
                                        see http://wiki.eclipse.org/M2E_plugin_execution_not_covered
                                     -->
                                    <ignore></ignore>
                                </action>
                            </pluginExecution>
                        </pluginExecutions>
                    </lifecycleMappingMetadata>
                </configuration>
            </plugin>
        </plugins>
    </pluginManagement>

这篇关于Jacoco Maven插件-生命周期配置未涵盖插件执行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆