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-mappingis 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.
For me it was similar issue
I had maven 3.0.3 and java 1.5
and my pom had
<executions> <execution> <id>enforce-versions</id> <goals> <goal>enforce</goal> </goals> <configuration> <rules> <requireMavenVersion> <version>[3.0.3,2.2.1,)</version> </requireMavenVersion> <requireJavaVersion> <version>[1.7, 1.8)</version> </requireJavaVersion> </rules> </configuration> </execution> </executions> </plugin>
As you can see I dont really have met rules, hence I updated Java and got mvn going and I was all set. Hope this helps someone.
Another pitfall exists when having several pluginExecutionFilters. These must be at the right spot in the pom.xml! For me it was gnarly to find as no error or warning of the displacement existed.
This is the right code for having several pluginExecutionFilters:
<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> <!-- now here follows the new filter --> <pluginExecution> <pluginExecutionFilter> <groupId>com.googlecode.maven-java-formatter-plugin</groupId> ...
How to eliminate the “maven-enforcer-plugin (goal ”enforce“) is ignored by m2e” warning by eclipse?
Although the eclipse
lifecycle-mapping plugin has worked for me on other projects, I can't change the
pom.xml since I am currently working in an IntelliJ shop with my covert instance of Eclipse and I don't want to expose myself by changing all of their pom files to include anything from group
After some experimentation, I've found that you can get this warning to not show up by changing the Lifecycle Mappings in the Maven preferences. Frankly I'm not 100% sure what this is doing but I've not seen any side effects so...
- In Eclipse, go to: Preferences → Maven → Lifecycle Mappings.
Open workspace lifecycle mappings metadatawhich will open the
lifecycle-mapping-metadata.xmlfile in a tab in the background. I assume that this cooresponds to the following file under your workspace subdir:
Next add the following stanza to the bottom of the file inside of
<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>
Once the XML file is saved you will need to go back to the preferences window and press
Reload workspace lifecycle mappings metadatawhich compiles the file somehow.
- Finally you will need to do a maven update-project on all of your projects to see the warnings go away.
Hope this helps.
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
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.
- How to eliminate the "maven-enforcer-plugin (goal "enforce") is ignored by m2e" warning by eclipse?
- How can I map Maven lifecycle phases not covered by the Eclipse m2e plugin?
- How to configure toolchains plugin in m2e / Installed maven in Eclipse
- When and how does m2e use the Maven test scope to include test dependencies in Eclipse Run Configurations?
- How does the m2e eclipse plugin interact with eclipse?
- Why does the m2e plugin build to a WEB-INF/classes in the target folder for a maven jar project?
- How can I install the M2E - Maven Integration in Eclipse?
- m2e maven eclipse plugin not configure the build path
- How can you import M2E Maven projects into Eclipse from the command line?
- How do I make the Eclipse Checkstyle plugin and the Maven Checkstyle plugin use the same rules?
- How to combine the update of a m2e maven project in Eclipse with a "maven build" run configuration to execute pom.xml
- How do I set the path of a goal while building a Maven project?
- How to use maven compiler plugin to grab all the warnings in eclipse
- how change the WAR file name inside EAR when deploying in Eclipse with no Maven plugin
- How to stop eclipse to redownload the plugin from repository for a maven project
- How to stop eclipse to redownload the plugin from repository for a maven project
- How stable is the git plugin for eclipse?
- How to include a config file in the "META-INF/services" folder of a JAR using Maven
- How to update the maven version without pom backup files
- How to solve maven 2.6 resource plugin dependency?
- How do I get verbose output from Maven in the Eclipse console?
- How do I start Maven "compile" goal on save in Eclipse?
- How do I find the correct Maven archetype project for developing with Scala in Eclipse?
- Web resources filtering with Maven war plugin does not work in Eclipse with m2e
- How to use eclox, the doxygen plugin for Eclipse
- How to install the Android ADT Plugin in Eclipse?
- How to install Maven integration plugin in Eclipse Helios?
- How to get the selected node in the package explorer from an Eclipse plugin
- Where does Maven store the source and javadocs when downloaded via the Eclipse plugin
- How to tell Maven to include the jar dependency, not the subproject source directory in Eclipse?
More Query from same tag
- When I paste a java file in eclipse src folder, it doesnt show up
- The type javax.swing.JComponent cannot be resolved - Eclipse
- How to import a Java library in Eclipse?
- Solid Java unit test automation? (JUnit/Hamcrest/...)
- How to add button to eclipse toolbar and connecting him to function xml extension Point
- Why sometimes happend like this in Eclipse?
- Is there any way to switch from Kepler to Indigo Ecplise?
- How to import android studio library project from github to eclipse stackover?
- Android Text Messaging
- How to prevent PyDev's autopep8 import formatter from moving site.addsitedir() calls?
- Renaming application
- Access the Eclipse Scala compiler from the terminal
- Scala IDE, import project from Maven and proper Scala bundle version selection
- Newbie setting up eclipse. How do I add java IDE to a c++/c packaged version of eclipse
- Groovy version 2.4.2 for Eclipse
- java.lang.ClassNotFoundException: SecuGen.FDxSDKPro.jni.JSGFPLib
- Eclipse add XText editor to perspective
- Team Synchronizing view in eclipse pulling a new class from remote repository
- How to import com.google.cloud.datastore in Eclipse?
- OpenShift 3 Tomcat Hello World Example
- Any way to mark specific files on Eclipse's Package Explorer? A bit like bookmarking but with a visual cue?
- Force Download on client machine
- My apps shut down immediately after opening it
- Parsing JSON that contains other language characters in UTF-8 Encoding
- Why use project clean in eclipse?
- Spell word with images in Android
- Garbage in Eclipse console log
- run maven command from console same as eclipse
- windowbuilder in helios with jdk5 doesn't work
- my java code disappears from java file eclipse