爪哇社区
  • 首页
  • 文章
  • 问答
  • 导航



  1. 首页
  2. 文章列表
  3. 在POM配置Maven plugin提示错误“Plugin execution not covered by lifecycle configuration”的解决方案

在POM配置Maven plugin提示错误“Plugin execution not covered by lifecycle configuration”的解决方案

发布:HelloJq 时间:2025-06-10

使用mybatis-generator 时 ,eclipse的POM文件的一处提示出错如下:不过这个错误不影响使用。

Plugin execution not covered by lifecycle configuration: org.mybatis.generator:mybatis-generator-maven-plugin:1.4.0:generate (execution: Generate MyBatis Artifacts, phase: generate-sources)

在网上找了一下,提示m2e在其执行maven的生命周期管理时没有定义该插件,所以提示出错,其实m2e对此是提供了扩展机制的,我们可以通过如下操作来消除这个出错提示:

1. 进入Window—>Preferences—>Maven配置,进入Lifecycle Mapping设置项,如下图:

  

从上图可以看出m2e管理maven生命周期的文件名是lifecycle-mapping-metadata.xml,以及该文件的存放路径

2. 修改lifecycle-mapping-metadata.xml

我的这个文件路径是: F:/xunzhu/workspace/javademo/.metadata/.plugins/org.eclipse.m2e.core/lifecycle-mapping-metadata.xml

但是当我们根据指定的路径去查找lifecycle-mapping-metadata.xml文件,发现这个文件在上图中提示的位置并不存在,

那么此时就以到eclipse的安装目录下的plugins下的 org.eclipse.m2e.lifecyclemapping.defaults_1.16.0.20200318-0852.jar  文件中找到该文件(如下图):

解压文件如下:

 

通过解压软件可以发现lifecycle-mapping-metadata.xml文件的确在jar包中,把它从jar包中解压出来并放置到前图所示的路径下

3. 打开lifecycle-mapping-metadata.xml文件,把未识别的插件在文件中加入即可,注意版本号;

 
 <!-- mybatis generator  plugins --> <pluginExecution> <pluginExecutionFilter> <groupId>org.mybatis.generator</groupId> <artifactId>mybatis-generator-maven-plugin</artifactId> <versionRange>[1.4,)</versionRange> <goals> <goal>generate</goal> </goals> </pluginExecutionFilter> <action> <ignore /> </action> </pluginExecution> </pluginExecutions>
 

将文件 lifecycle-mapping-metadata.xml 替换到 jar包文件中同名文件;或者将当前lifecycle-mapping-metadata.xml文件放在之前未找到的路径下面。

重启Eclipse并即可消除出错误提示。

 


爪哇社区 © 2024