我正在尝试使用 maven-warpath-plugin available here 。但我的 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)
如何解决这个问题?这是我的插件的 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 连接器”来解决此错误。我已经安装了大多数似乎适用的可用连接器,但错误仍然存在。我有什么想法可以让这项工作成功吗?
最佳答案
这是新的behaviour m2e(取代了旧的 m2eclipse 插件)。要指定 eclipse 应该对插件执行什么操作,您必须在项目的 pom.xml 中配置构建生命周期映射 - 或者安装一个连接器(它决定插件是否需要在 eclipse 构建中执行)(如果存在)。
由于 maven-warpath-plugin 似乎没有连接器,因此您必须在 pom.xml 中定义行为。您可以使用第二个 Eclipse 快速修复程序(永久将 pom.xml 中的目标添加类标记为在 Eclipse 构建中忽略)。这会将以下部分添加到您的 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>
您可以更改 <ignore>
行动至<execute>
如果您想在每个 Eclipse 构建中处理插件(在 import
、 clean
、...)。
插件配置是 eclipse 特定的,不会使 pom.xml 看起来更好 - 但至少它对 Maven 构建没有影响......
关于eclipse - 插件错误: execution not covered by lifecycle configuration,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7391201/