错误类型:
Plugin execution not covered by lifecycle configuration: org.apache.maven.plugins:maven-antrun-plugin:1.7:run (execution: define-classpath, phase: process-resources)
错误原因:
eclipse的m2e插件还没有支持到execution
网上找到的比较详细的错误解释:
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.
Plugin execution not covered by lifecycle configuration: org.apache.maven.plugins:maven-antrun-plugin:1.3:run(execution: generate-sources-input, phase: generate-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.
解决方案:
修改pom文件:
添加如下:
<build> <pluginManagement> <plugins> <!-- add by M--> <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-antrun-plugin</artifactId> <goals> <goal>run</goal> </goals> <versionRange>[1.7,)</versionRange> </pluginExecutionFilter> <action> <ignore /> </action> </pluginExecution> </pluginExecutions> </lifecycleMappingMetadata> </configuration> </plugin> <!-- end ending -->
注意在错误中,
Plugin execution not covered by lifecycle configuration: org.apache.maven.plugins:maven-antrun-plugin:1.7:run (execution: define-classpath, phase: process-resources)
上述所填内容中,groupId就是configuration冒号后面的内容,artifactId为再冒号后面的内容;版本号versionRange为后面的版本号,goal为版本号后面的run
如果该错误是出现在pom文件中的parent标签,则要在parent项目的pom文件中添加该内容,如果是出现在本pom文件的excution处,则是在该pom文件出错的plugins标签内添加该内容。
最后要记得在修改完之后,点击项目的右键—Maven—Update Project
pluginManagement标签的作用是作为公用的插件配置项,给子项目共用的。
http://liwenqiu.me/blog/2012/12/19/maven-lifecycle-mapping-not-converted/
https://www.eclipse.org/m2e/documentation/m2e-execution-not-covered.html之后,要做的就是告诉eclipse要忽略的goal.
参考:
http://blog.csdn.net/xxd851116/article/details/25197373
http://blog.sina.com.cn/s/blog_725eee7e01015axt.html
原创文章,作者:奋斗,如若转载,请注明出处:https://blog.ytso.com/13783.html