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

52,631

Solution 1

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

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

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

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: - Checkout https://github.com/mfriedenhagen/dummy-lifecycle-mapping-plugin. - Run mvn install when you are on your own - Run mvn deploy -DaltDeploymentRepository=REPO_ID::default::YOUR_THIRDPARTY_REPO_URL when you have a repository manager like Nexus or Artifactory. - See https://github.com/mfriedenhagen/dummy-lifecycle-mapping-plugin/blob/master/README.creole as well.

Regards Mirko

Share:
52,631
Ralph
Author by

Ralph

Updated on May 12, 2020

Comments

  • Ralph
    Ralph about 4 years

    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. (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.