当公司项目,pom.xml报错
Plugin execution not covered by lifecycle configuration: org.apache.maven.plugins:maven-plugin-plugin:3.2:descriptor (execution: default-descriptor, phase: generate-resources)
pom.xml代码段如下
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-plugin-plugin</artifactId>
<version>3.2</version>
<configuration>
<goalPrefix>gboat2.doc.generator</goalPrefix>
<skipErrorNoDescriptorsFound>true</skipErrorNoDescriptorsFound>
</configuration>
<executions>
<execution>
<id>mojo-descriptor</id>
<goals>
<goal>descriptor</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
解决方案:
- 在Eclipse的工作空间中找到这个文件(没有则新建):workSpace(你的工作空间)\.metadata\.plugins\org.eclipse.m2e.core\lifecycle-mapping-metadata.xml;
-
文件内容如下,但<groupId>、<artifactId>、<versionRange>、<goal>要与pom.xml中报错部分一致;
<?xml version="1.0" encoding="UTF-8"?> <lifecycleMappingMetadata> <pluginExecutions> <pluginExecution> <pluginExecutionFilter> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-plugin-plugin</artifactId> <versionRange>[3.2,)</versionRange> <goals> <goal>descriptor</goal> </goals> </pluginExecutionFilter> <action> <ignore/> </action> </pluginExecution> </pluginExecutions> </lifecycleMappingMetadata>
-
文件保存后需在eclipse中做如下操作:Windows → Preferences → Maven → Lifecycle mappings点击Reload workspace lifecycle mappings metadata按钮;
-
如果报错仍然没有消失,则在报错项目上右键Maven→Update Project即可;