插件错误:执行没有被生命周期配置覆盖

时间:2023-01-25 11:43:52

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:

我如何解决这个问题?这是我的砰的一声。插件的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连接器”以解决这个错误。我已经安装了大多数可以使用的连接器,但是错误仍然存在。你知道我该怎么做吗?

2 个解决方案

#1


29  

This is the new behaviour of 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中的行为。您可以使用第二个eclipse quickfix来实现这个功能(pom中的Permamnently标记目标扩展类)。在eclipse构建中忽略的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构建中处理插件,可以将 操作更改为 (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构建....

#2


2  

Also see the answer How to solve "Plugin execution not covered by lifecycle configuration" for Spring Data Maven Builds

还可以看到如何解决Spring Data Maven构建的“不包括生命周期配置”的“插件执行”。

#1


29  

This is the new behaviour of 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中的行为。您可以使用第二个eclipse quickfix来实现这个功能(pom中的Permamnently标记目标扩展类)。在eclipse构建中忽略的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构建中处理插件,可以将 操作更改为 (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构建....

#2


2  

Also see the answer How to solve "Plugin execution not covered by lifecycle configuration" for Spring Data Maven Builds

还可以看到如何解决Spring Data Maven构建的“不包括生命周期配置”的“插件执行”。