我的 pom.xml 很好,我可以毫无问题地进行 mvn clean 安装,但 eclipse 将其涂成红色并提示:
Description Resource Path Location Type
Plugin execution not covered by lifecycle configuration: org.jacoco:jacoco-maven-plugin:0.5.10.201208310627:prepare-agent (execution: default, phase: initialize) pom.xml /super-project line 11 Maven Project Build Lifecycle Mapping Problem
我如何告诉 eclipse 忘记 pom.xml,换句话说,不要尝试编译它、验证它等,这样我的项目就不会出现错误,也不会被涂成红色?
最佳答案
我过去也遇到过类似的问题,eclipse 不喜欢 pom.xml 中的插件。我找到的解决方案是使用插件管理。我自己的代码的一个例子是:
<pluginManagement>
<plugins>
<!--This plugin's configuration is used to store Eclipse m2e settings
only. It has no influence on the Maven build itself. -->
<plugin>
<groupId>org.eclipse.m2e</groupId>
<artifactId>lifecycle-mapping</artifactId>
<version>1.0.0</version>
<configuration>
<lifecycleMappingMetadata>
<pluginExecutions>
<pluginExecution>
<pluginExecutionFilter>
<groupId>
org.apache.maven.plugins
</groupId>
<artifactId>
maven-dependency-plugin
</artifactId>
<versionRange>
[2.6,)
</versionRange>
<goals>
<goal>
copy-dependencies
</goal>
</goals>
</pluginExecutionFilter>
<action>
<ignore />
</action>
</pluginExecution>
</pluginExecutions>
</lifecycleMappingMetadata>
</configuration>
</plugin>
</plugins>
</pluginManagement>
这很困惑,但也可以防止 future 的开发人员遇到同样的麻烦。
official m2e page如果您运行的是 4.2 Juno,有办法忽略它们
关于java - 如何告诉 eclipse 在不更改 pom.xml 的情况下不要验证 pom.xml?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14984068/