eclipse 插件错误:生命周期配置未涵盖执行

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/7391201/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-10 20:31:20  来源:igfitidea点击:

Plugin error: execution not covered by lifecycle configuration

eclipsemavenmaven-pluginm2eclipsem2e

提问by Ayyoudy

I am trying to use the maven-warpath-plugin available here. But I keep getting an error in my pom.xml file that says:

我正在尝试使用这里可用的 maven-warpath-plugin 。但是我的 pom.xml 文件中不断出现错误,内容为:

Plugin execution not covered by lifecycle configuration: org.appfuse.plugins:maven-warpath-plugin:2.1.0:add-classes (execution: default, phase: generate-sources)

生命周期配置未涵盖的插件执行:org.appfuse.plugins:maven-warpath-plugin:2.1.0:add-classes(执行:默认,阶段:生成源)

How do I resolve this? Here is my pom.xml snippet for the plugin:

我该如何解决?这是我的插件 pom.xml 片段:

<plugin>
    <groupId>org.appfuse.plugins</groupId>
    <artifactId>maven-warpath-plugin</artifactId>
    <version>2.1.0</version>
    <extensions>true</extensions>
    <executions>
        <execution>
            <goals>
                <goal>add-classes</goal>
            </goals>
        </execution>
    </executions>
</plugin>

Eclipse offers me a quickfox tip to "discover new m2e connectors" to resolve this error. I have installed most of the connectors available that seem to apply but the error is still there. Any ideas how I could make this work?

Eclipse 为我提供了一个 quickfox 提示来“发现新的 m2e 连接器”来解决这个错误。我已经安装了大多数似乎适用的可用连接器,但错误仍然存​​在。有什么想法可以让我完成这项工作吗?

回答by FrVaBe

This is the new behaviourof m2e (which replaced the old m2eclipse plugin). To specify what eclipse should do with the plugin you have to configure the build lifecycle mapping in the project's pom.xml - or install a connector (which decides if the plugin needs to be executed in an eclipse build or not) if it exists.

这是m2e的新行为(取代了旧的 m2eclipse 插件)。要指定 eclipse 应该对插件做什么,您必须在项目的 pom.xml 中配置构建生命周期映射 - 或者安装一个连接器(它决定插件是否需要在 eclipse 构建中执行)(如果它存在)。

As there seems to be no connector for the maven-warpath-plugin yet you have to define the behaviour in the pom. You can use the second eclipse quickfix for this (Permamnently mark goal add-classes in pom.xml as ignored in eclipse build). This will add the following section to your pom:

由于 maven-warpath-plugin 似乎没有连接器,但您必须在 pom.xml 中定义行为。您可以为此使用第二个 eclipse quickfix(在 eclipse build 中将 pom.xml 中的目标添加类永久标记为忽略)。这会将以下部分添加到您的 pom 中:

<build>
    ......
    <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.appfuse.plugins
                                    </groupId>
                                    <artifactId>
                                        maven-warpath-plugin
                                    </artifactId>
                                    <versionRange>
                                        [2.1.0,)
                                    </versionRange>
                                    <goals>
                                        <goal>add-classes</goal>
                                    </goals>
                                </pluginExecutionFilter>
                                <action>
                                    <ignore></ignore>
                                </action>
                            </pluginExecution>
                        </pluginExecutions>
                    </lifecycleMappingMetadata>
                </configuration>
            </plugin>
        </plugins>
    </pluginManagement>
</build>

You can change the <ignore>action to <execute>if you want to process the plugin in each eclipse build (on import, clean, ...).

如果您想在每个 Eclipse 构建中处理插件,您可以将<ignore>操作更改为<execute>(on import, clean, ...)。

The plugin configuration is eclipse specific and does not make the pom.xml look nicer - but at least it has no influence on the Maven build....

插件配置是特定于 Eclipse 的,不会使 pom.xml 看起来更好 - 但至少它对 Maven 构建没有影响....