---
title: "pom文件报Plugin execution not covered by lifecycle configuration。"
author: "Janne"
date: "2020-07-16T01:03:27Z"
tags: []
categories: ["编程语言"]
slug: "pom-plugin-execution-not-covered-by-lifecycle-configuration"
draft: false
lastmod: "2020-07-16T01:03:27Z"
id: 2515690
url: "https://janne.iteye.com/blog/2515690"
---

pom文件报Plugin execution not covered by lifecycle configuration。


参考：http://blog.sina.com.cn/s/blog_9ba71d0b0102wzf2.html 和 https://blog.csdn.net/qq_32617311/article/details/82698897

eclipse在其POM文件的一处提示出错如下：
Plugin execution not covered by lifecycle configuration: org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (execution: default-compile, phase: compile)
 
这表示m2e在其执行maven的生命周期管理时没有定义该插件，所以提示出错，其实m2e对此是提供了扩展机制的，我们可以通过如下操作来消除这个出错提示：
1. 进入Window—>Preferences—>Maven配置，进入Lifecycle Mapping设置项，如下图：
   
   从上图可以看出m2e管理maven生命周期的文件名是lifecycle-mapping-metadata.xml，以及该文件的存放路径
2. 下一步我们就要去相应路径修改lifecycle-mapping-metadata.xml文件，但会发现这个文件在上图中提示的位置并不存在，那么此时就
以到eclipse的安装目录下的plugins下的org.eclipse.m2e.lifecyclemapping.defaults_xxxxxx.jar文件中找到该文件（如下图）:

 
通过解压软件可以发现lifecycle-mapping-metadata.xml文件的确在jar包中，把它从jar包中解压出来并放置到前图所示的路径下
3. 打开lifecycle-mapping-metadata.xml文件，把未识别的插件在文件中加入即可：
如：错误信息：
- Plugin execution not covered by lifecycle configuration: org.apache.maven.plugins:maven-compiler-plugin:3.7.0:testCompile (execution: default-testCompile,phase: test-compile)
添加以下内容
<pluginExecutionFilter>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-compiler-plugin</artifactId> 
    <goals>
      <goal>resources</goal>
      <goal>testResources</goal>
      <goal>copy-resources</goal>
      <goal>compile</goal>
      <goal>testCompile</goal>
    </goals>
    <versionRange>[2.5.1,)</versionRange>
</pluginExecutionFilter>123456789101112

最后，
4.修改完成后，在windows–>Preferences的maven中将Update Maven projects on startup勾上，重启eclipse即可消除出错示。