get rid of POM not found warning for org.eclipse.m2e:lifecycle-mapping

JavaEclipseMavenM2eclipseM2e

Java Problem Overview


With intent to get m2e 1.0 working correctly I have had to specify the lifecycle mapping:

	<pluginManagement>
		<plugins>
			<plugin>
				<groupId>org.eclipse.m2e</groupId>
				<artifactId>lifecycle-mapping</artifactId>
				<version>1.0.0</version>
				<configuration>
					<lifecycleMappingMetadata>
						<pluginExecutions>
        					<pluginExecution>
          						<pluginExecutionFilter>
            						<groupId>org.bsc.maven</groupId>
            						<artifactId>maven-processor-plugin</artifactId>
            						<versionRange>[2.0.2,)</versionRange>
            						<goals>
              							<goal>process</goal>
            						</goals>
          						</pluginExecutionFilter>
          						<action>
            						<execute />
          						</action>
        					</pluginExecution>
        				</pluginExecutions>         				
					</lifecycleMappingMetadata>
				</configuration>
			</plugin>
		</plugins>
	</pluginManagement>

But then I get this warning:

 [WARNING] The POM for org.eclipse.m2e:lifecycle-mapping:jar:1.0.0 is missing, no dependency information available
 [WARNING] Failed to retrieve plugin descriptor for org.eclipse.m2e:lifecycle-mapping:1.0.0: Plugin org.eclipse.m2e:lifecycle-mapping:1.0.0 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.eclipse.m2e:lifecycle-mapping:jar:1.0.0

if I run some specific maven task for example mvn clean install findbugs:findbugs (If I run only mvn clean install then there is no such message)

I know that the problem is that this POM does not exists, because it is only defined to hold the mapping information. (https://stackoverflow.com/questions/7409823/m2e-lifecycle-mapping-not-found)

Anyway, I want to keep my build clean, without any warnings, so how can I get rid of this specific one? (My CI server checks that there is no warning.)

I use Maven 3.0.2 and tried Maven 3.0.3 too, but the same result.

Java Solutions


Solution 1 - Java

My team works around this problem by wrapping the relevant configuration in a profile:

<profile>
  <id>only-eclipse</id>
  <activation>
    <property>
      <name>m2e.version</name>
    </property>
  </activation>
  <build>
    <pluginManagement>
      <plugins>
        <plugin>
          <groupId>org.eclipse.m2e</groupId>
          <artifactId>lifecycle-mapping</artifactId>
          <version>1.0.0</version>
          <configuration>
            ...
          </configuration>
        </plugin>
      </plugins>
    </pluginManagement>
  </build>
</profile>

Solution 2 - Java

This a known bug with WONTFIX resolution. The suggested solution is the simplest in my opinion:

mvn archetype:generate -DgroupId=org.eclipse.m2e -DartifactId=lifecycle-mapping \
 -Dversion=1.0.0 -DarchetypeArtifactId=maven-archetype-mojo

and install this project.

Solution 3 - Java

m2eclipse 1.7.0 introduced an alternative, namely an XML processing instruction.

In the original example, you would simply “annotate” every <execution> of the maven-processor-plugin’s process goal with

<?m2e execute?>

See the release notes for more details on the syntax and further options.

Solution 4 - Java

This solution is now deprecated, I would recommend using the "profile" solution by @ctrueden which is the accepted answer!

*While not the most clean solution, when you use a repository manager in your company or are on your own, in the mean time you may do this:

Regards Mirko

Solution 5 - Java

Now there's now better solution (for the error messages in Eclipse only).

Press CTR+1 on the error Plugin execution not covered by lifecycle configuration: org.codehaus.mojo:buildnumber-maven-plugin:1.1:create-timestamp (execution: default-create-timestamp, phase: validate) and then select this option:

enter image description here

This works with org.eclipse.m2e.editor.xml_1.2.0.20120903-1050.jar plugin (maybe earlier also)

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionRalphView Question on Stackoverflow
Solution 1 - JavactruedenView Answer on Stackoverflow
Solution 2 - JavaallprogView Answer on Stackoverflow
Solution 3 - JavaAndreas SeweView Answer on Stackoverflow
Solution 4 - JavaMirko FriedenhagenView Answer on Stackoverflow
Solution 5 - JavaGrzegorz GrzybekView Answer on Stackoverflow