天天看点

解决Maven报Plugin execution not covered by lifecycle configuration

错误:Plugin execution not covered by lifecycle configuration: org.apache.maven.plugins:maven-antrun-plugin:1.7:run (execution: define-classpath, phase: process-resources)

官网解决方法:https://www.eclipse.org/m2e/documentation/m2e-execution-not-covered.html

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

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

解决Maven报Plugin execution not covered by lifecycle configuration

2. 下一步找到文件的存放路径,修改lifecycle-mapping-metadata.xml文件,提示的位置并不存在,那么此时就到eclipse的安装目录下的plugins下的org.eclipse.m2e.lifecyclemapping.defaults_xxxxxx.jar文件中找到该文件(如下图),将文件从jar包中解压出来粘贴到之前的文件路径下。

解决Maven报Plugin execution not covered by lifecycle configuration

3. 打开lifecycle-mapping-metadata.xml文件,添加如下:

<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>
           

4.修改Maven配置,选择“Update Maven projects on startup”,重启eclipse。

解决Maven报Plugin execution not covered by lifecycle configuration

继续阅读