在升级到 Eclipse Luna 或 m2e 1.5.x 并使用 Maven 插件项目打开现有工作区后,Eclipse 抱怨说
Plugin execution not covered by lifecycle configuration:
org.apache.maven.plugins:maven-plugin-plugin ...
在升级到 Eclipse Luna 或 m2e 1.5.x 并使用 Maven 插件项目打开现有工作区后,Eclipse 抱怨说
Plugin execution not covered by lifecycle configuration:
org.apache.maven.plugins:maven-plugin-plugin ...
您需要告诉 m2eclipse 如何处理插件执行。
例如,如果消息是:
Plugin execution not covered by lifecycle configuration: org.apache.maven.plugins:maven-plugin-plugin:3.2:descriptor
使用以下代码段:
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.eclipse.m2e</groupId>
<artifactId>lifecycle-mapping</artifactId>
<version>1.0.0</version>
<configuration>
<lifecycleMappingMetadata>
<pluginExecutions>
<pluginExecution>
<pluginExecutionFilter>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-plugin-plugin</artifactId>
<versionRange>[3.2,)</versionRange>
<goals>
<goal>descriptor</goal>
</goals>
</pluginExecutionFilter>
<action>
<ignore />
</action>
</pluginExecution>
</pluginExecutions>
</lifecycleMappingMetadata>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
在1.4.x版本之前,maven-plugin-plugin 被 m2e 附带的默认生命周期映射覆盖。
从1.5.x版本开始,m2e 默认生命周期映射不再涵盖 maven-plugin-plugin。
要获得对 m2e 版本 1.5.x 的 maven-plugin-plugin 的支持,请安装新的Maven 开发工具插件。
升级到 Eclipse Luna 后,您可能会注意到这个问题,因为它默认附带 1.5.x。
对于那些使用更新的 Eclipse 版本(撰写本文时为 2020-12 年)来到这里的人。
以下部分未涵盖M2Eclipse 页面执行:
Eclipse 4.2 添加默认映射
如果您正在使用 Eclipse [...] 并且在映射方面遇到问题并且不会在
pom.xml
创建新文件lifecycle-mapping-metadata.xml
并在Windows → Preferences → Maven → Lifecycle Mappings中配置它(不要忘记Reload workspace lifecycle mappings metadata在每次更改后按这个文件!)。
[由我更正和格式化。]
maven-plugin-plugin
将以下内容添加到lifecycle-mapping-metadata.xml
:
<pluginExecution>
<pluginExecutionFilter>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-plugin-plugin</artifactId>
<versionRange>[0,)</versionRange>
<goals>
<goal>descriptor</goal>
<goal>helpmojo</goal>
</goals>
</pluginExecutionFilter>
<action>
<ignore />
</action>
</pluginExecution>
Reload workspace lifecycle mappings metadata
右键单击项目 → Maven →更新项目...或Alt+F5
请参阅生命周期配置未涵盖的具有插件执行的标记:...正在消失。
支持这个答案。:)
另请参阅如何映射 Eclipse m2e 插件未涵盖的 Maven 生命周期阶段的丰富答案?.