eclipse 问题之一:Plugin execution not covered by lifecycle configuration

1、问题

eclipse 作为 java 工程的开发工具,可以集成maven 直接管理 maven 工程。 但是对于maven工程中描述的插件,有时候 eclipse 会报如下错误(示例:Plugin execution not covered by lifecycle configuration: org.codehaus.mojo:exec-maven-plugin:3.1.1:java (execution: default, phase: compile)),导致 maven工程无法正常更新。

2、解决办法

1)  进入Window—>Preferences—>Maven —> Lifecycle Mapping 查看  lifecycle-mapping-metadata.xml文件路径

 

2) 进入该路径 对lifecycle-mapping-metadata.xml 文件进行编辑。 如果在该路径下 找不到相应文件。可以在eclipse 安装目录下的 plugins下的 org.eclipse.m2e.lifecyclemapping.defaults_xxxxxx.jar 中找到 解压出来 加入未识别的插件

<pluginExecution>
      <pluginExecutionFilter>
        <groupId>org.codehaus.mojo</groupId> 
        <artifactId>exec-maven-plugin</artifactId><!-- 插件名称 -->
        <versionRange>[1.0,)</versionRange> <!-- 版本范围-->  
        <goals>
          <goal>java</goal><!--mvn 命令就是 xx-plugin后面的那串 --> <!-- 这个值填写 eclipse报错误的   org.codehaus.mojo:exec-maven-plugin:3.1.1:java (execution: default, phase: compile)  中的 java  这里仅是示例,其它也是这样-->
        </goals>
      </pluginExecutionFilter>
      <action>
        <ignore />
      </action>
    </pluginExecution>
     <pluginExecution>
      <pluginExecutionFilter>
        <groupId>com.github.geequery</groupId> 
        <artifactId>geequery-maven-plugin</artifactId><!-- 插件名称 -->
        <versionRange>[1.0,)</versionRange> <!-- 版本范围-->
        <goals>
          <goal>enhance</goal><!--mvn 命令就是 xx-plugin后面的那串 --> <!-- 这个值填写 eclipse报错误的   com.github.geequery:geequery-maven-plugin:1.12.5.3:enhance (execution: default, phase: compile)  中的 enhance  这里仅是示例,其它也是这样-->
        </goals> </pluginExecutionFilter>
<action>
<ignore />
</action>
</pluginExecution>

 3) 进入Window—>Preferences—>Maven ,勾选上“Update Maven projects on startup”选项勾上,并重启eclipse即可消除出错示。

 

posted @ 2024-03-15 10:21  夏之夜  阅读(164)  评论(0编辑  收藏  举报