首页 文章

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

提问于
浏览
15

我正在尝试使用maven-warpath-plugin available here . 但是我的pom.xml文件中出现了一个错误:

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

我该如何解决这个问题?这是我的插件的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为我提供了一个“发现新的m2e连接器”的快速提示,以解决此错误 . 我已经安装了大多数似乎适用的连接器,但错误仍然存在 . 我有什么想法可以使这项工作?

2 回答

  • 2

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

    由于maven-warpath-plugin似乎没有连接器,你必须在pom中定义行为 . 您可以使用第二个eclipse quickfix(在eclipse构建中忽略pom.xml中的永久性标记目标add-classes) . 这会将以下部分添加到您的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>
    

    如果要在每个eclipse构建中处理插件(在 importclean ,...上),可以将 <ignore> 操作更改为 <execute> .

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

相关问题