How to eliminate the "maven-enforcer-plugin (goal "enforce") is ignored by m2e" warning by eclipse?
Solution 1:
The eclipse maven plugin runs a projects pom.xml file in order figure out how the maven project is configured and translate the maven pom.xml configuration into an eclipse configuration. A pom.xml can reference an arbitrary number of maven plugins and each of those plugins has the potential to leak memory, or do things that are harmful to eclipse. So by default the m2e eclipse plugin ignores any maven plugins unless those maven plugins have a special m2e plugin connector that tells m2e how to integrate the maven plugin into eclipse. In summary m2e is defending the eclipse JVM process against a buggy maven plugin, by saying that for every maven plugin there needs to be an m2e connector to bridge between maven and eclipse.
So to get rid of the warning I added the following to my plugin management section of the parent pom.xml
<build>
<pluginManagement>
<plugins>
<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-enforcer-plugin</artifactId>
<versionRange>[1.0.0,)</versionRange>
<goals>
<goal>enforce</goal>
</goals>
</pluginExecutionFilter>
<action>
<ignore />
</action>
</pluginExecution>
</pluginExecutions>
</lifecycleMappingMetadata>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
It seems that org.eclipse.m2e:lifecycle-mapping
is a maven plugin designed to hold meta data to communicate with eclipse m2e plugin when it processes a maven pom.xml and this information is used to tell eclipse what do with maven plugins that are defined in pom.xml when eclipse runs the pom.xml as part of the eclipse UI.
Solution 2:
From m2e version 1.4 and higher: You can integrate the needed lifecycle-configuration within the pom (parent-pom or project-pom) or you can integrate the informations into the global m2e-configuration within eclipse. Also you have some quickfix-actions for applying this changes.
The last option is to look for m2e-connectors or to switch over to newer versions of different maven-plugins with integrated m2e-support (e.g. for jaxb-plugins).
Here (for enforcer-plugin) I think, the definition in the pom is the easiest way.
See also: https://www.eclipse.org/m2e/documentation/m2e-execution-not-covered.html
Solution 3:
Just an FYI for those of you that have an issue with configuring your IDE in your build model. Keep an eye on this enhancement request currently targeted for the Kepler release:
Bug 350414: Store ignored m2e connectors outside project pom.xml https://bugs.eclipse.org/bugs/show_bug.cgi?id=350414