子模块Maven报Plugin execution not covered by lifecycle configuration

当在maven中,子模块依赖父maven项目时,发现在parent处有报错,如下


返回overview查看具体错误

Plugin execution not covered by lifecycle configuration: org.apache.maven.plugins:maven-checkstyle-plugin:2.17:check (execution: validate, phase: validate)



这是m2e在其执行maven的生命周期管理时没有定义该插件。具体解决如下

1、Windows->Preferences->Maven->Lifecycle Mappings


子模块Maven报Plugin execution not covered by lifecycle configuration_第1张图片

2、去找E:/github/designwp/.metadata/.plugins/org.eclipse.m2e.core/lifecycle-mapping-metadata.xml这个文件,发现在org.eclipse.m2e.core目录下并没有lifecycle-mapping-metadata.xml。

3、到eclipse安装目录plugins下找到org.eclipse.m2e.lifecyclemapping.defaults_*****.jar。解压


子模块Maven报Plugin execution not covered by lifecycle configuration_第2张图片

4、编辑lifecycle-mapping-metadata.xml,把报错提示中的plugin添加进来。

      org.apache.maven.plugins:maven-checkstyle-plugin:2.17:check

     按冒号隔开,4个值分别是 groupId:artifactId:versionRange:goal

子模块Maven报Plugin execution not covered by lifecycle configuration_第3张图片

5、把编辑完之后的lifecycle-mapping-metadata.xml复制到第一步,即E:/github/designwp/.metadata/.plugins/org.eclipse.m2e.core目录下。

6、Update Maven projects on startup 勾上


子模块Maven报Plugin execution not covered by lifecycle configuration_第4张图片

7、重启eclipse,即可解除报错。

你可能感兴趣的:(子模块Maven报Plugin execution not covered by lifecycle configuration)