Maven —— Plugin execution not covered by lifecycle configuration 错误

2023-11-11

转载自:https://blog.csdn.net/lmxmimihuhu/article/details/34436205


一、错误描述

Eclipse 导入已存在的Maven 后,pom.xml 文件的execution 节点报错,错误位置及错误信息如下:

错误位置:


错误信息:

Plugin execution not covered by lifecycle configuration: org.apache.maven.plugins:maven-antrun-plugin:1.3:run (execution: default, phase: compile)


二、错误解决方法

方法一:

将<plugins/>元素用<pluginManagement/>标签包裹;

方法二:

将出错的<plugin/>独立写在一个<plugins/>标签中,之后该<plugins/>元素单独用<pluginManagement/>标签包裹;

方法三:

具体查看http://liwenqiu.me/blog/2012/12/19/maven-lifecycle-mapping-not-converted/


三、错误解决过程与思路

原文如下:

首先,从如下链接找到方法一的解决方案:

http://stackoverflow.com/questions/6352208/how-to-solve-plugin-execution-not-covered-by-lifecycle-configuration-for-sprin

链接中部分原文:

To solve some long-standing issues, m2e 1.0 requires explicit instructions what to do with all Maven plugins bound to 
"interesting" phases (see M2E interesting lifecycle phases) of project build lifecycle. We call these instructions "project 
build lifecycle mapping" or simply "lifecycle mapping" because they define how m2e maps information from project pom.xml 
file to Eclipse workspace project configuration and behaviour during Eclipse workspace build.

Project build lifecycle mapping configuration can be specified in project pom.xml, contributed by Eclipse plugins and 
there is also default configuration for some commonly used Maven plugins shipped with m2e. We call these "lifecycle mapping 
metadata sources". m2e will create error marker like below for all plugin executions that do not have lifecycle mapping in 
any of the mapping metadata sources.
m2e matches plugin executions to actions using combination of plugin groupId, artifactId, version range and goal. There are 
three basic actions that m2e can be instructed to do with a plugin execution --ignore, execute and delegate to a project 
configurator.

最终,提到了前面所述的解决方法一。

至于解决方法二,是因为pluginManagement的作用是作为公用的插件配置项,给子项目共用的(当然项目没子项目那就不用纠结)。

可有人比额领导还纠结,说这个配置不该放在pom文件里,应该是ide来处理这个配置,就有了方法三:

http://liwenqiu.me/blog/2012/12/19/maven-lifecycle-mapping-not-converted/

在eclipse->preference->maven->lifecycle mappings中,myeclipse的话Maven4MyEclipse->Lifecycle mappings,想上面所示进行配置,保存更新project。未试过eclipse下情况如何,MyEclipse默认配置路径是没有lifecycle-mapping-metadata.xml这个文件的,只有<项目名>.lifecyclemapping一系列这样的文件,但提供一个按钮“Open workspace lifecycle mappings metadata”里进行编辑。或者Change mapping file location。

      好吧,这样也许是最应该的处理的方式,但让每个开发人员都改下ide配置,还不如直接改下pom.xml文件的配置,最终采用了修改pom.xml文件的方式。

Plugin execution not covered by lifecycle configuration: org.apache.maven.plugins:maven-dependency-plugin:2.6:copy (execution: default, phase: validate)
由于我个人更倾向于在命令行下让maven干活,而eclipse更多的只是充当编辑器的角色,所以我要的只是让eclipse忽略掉这些goal就好了。

参考这里http://wiki.eclipse.org/M2E_plugin_execution_not_covered 之后,要做的就是告诉eclipse要忽略的goal.














本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

Maven —— Plugin execution not covered by lifecycle configuration 错误 的相关文章

随机推荐