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

Ayy*_*udy 16 eclipse m2eclipse maven-plugin maven m2e

我正在尝试使用这里提供的maven-warpath-plugin .但是我的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>
Run Code Online (Sandbox Code Playgroud)

Eclipse为我提供了一个"发现新的m2e连接器"的快速提示,以解决此错误.我已经安装了大多数似乎适用的连接器,但错误仍然存​​在.我有什么想法可以使这项工作?

FrV*_*aBe 30

这是m2e 的新行为(取代了旧的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>
Run Code Online (Sandbox Code Playgroud)

您可以更改<ignore>动作<execute>,如果你想处理每个Eclipse构建插件(上import,clean...).

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