68

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.

Community
  • 1
  • 1
Ralph
  • 118,862
  • 56
  • 287
  • 383
  • Which Maven version are you running? – khmarbaise Oct 26 '11 at 16:25
  • @khmarbaise: It is maven 3.0.2 – Ralph Oct 26 '11 at 16:52
  • Can you post the complete POM of this project...cause i assume that you have a dependency somewhere in your pom...BTW: Have you tried to run this with Maven 3.0.3 ? – khmarbaise Oct 26 '11 at 17:04
  • @khmarbaise: do you mean an other dependency than the one I have already posted? – Ralph Oct 26 '11 at 17:30
  • @khmarbaise: it is the same behaviour for Maven 3.0.3 – Ralph Oct 26 '11 at 17:34
  • @khmarbaise: I tyed to add the complete pom, but it is to large. Anyway I guess it is clear where the problem come from, and the warning is correct, but who to get rid of it? – Ralph Oct 26 '11 at 17:51
  • In contradiction to what you've written it's not clear. Furthermore if your pom is to large things like pastebin.ca exist...Anyway. Have you tried to comment out the whole pluginManagement part with the lifecylce-mapping to check if this is the real cause of your problem? – khmarbaise Oct 27 '11 at 07:34
  • @khmarbaise: I have done the check the other way around: the warning is gone when I remove this plugin. -- And yes the plugin really do not exist, the the warning itself is correct, but for this special plugin it does not matter! – Ralph Oct 27 '11 at 08:43
  • I have opened a (trivial) bug for this at m2e. Vote for it if you want it fixed. https://bugs.eclipse.org/bugs/show_bug.cgi?id=367870 – Ben Jan 04 '12 at 16:33
  • Still the same with Maven 3.0.4-RC3. – Mirko Friedenhagen Jan 05 '12 at 10:07
  • @Mirko Friedenhagen: it is not a maven problem, its a problem of lifecycle-mapping plugin. – Ralph Jan 05 '12 at 10:41
  • Although the update to local nexus solution have been deprecated the artifact build using this link https://github.com/earcam/m2e-stfu and **uploading to nexus** solves the issue. – Vincent Jyotirmoy Singha - JS May 12 '20 at 07:53

5 Answers5

73

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>
ctrueden
  • 6,751
  • 3
  • 37
  • 69
  • @Ralph Nope, the property activation works because only Eclipse defines the m2e.version property -- it is not activated by vanilla Maven, or in other IDEs. It does assume you are using the M2E Eclipse integration (File > Import > Existing Maven Project) rather than the old eclipse:eclipse goal, though. – ctrueden May 18 '14 at 22:00
  • @ctrueden thanks for this - I've ref. it from https://bugs.eclipse.org/bugs/show_bug.cgi?id=367870 – vorburger Aug 29 '14 at 17:00
  • 2
    This should be the accepted solution. It fixes the warning, works with current eclipses out of the box and doesn't rely on local repositories or caches, so it works in CI environments as well. – noamik Nov 27 '14 at 13:42
  • 1
    this works like a charm, thank you very much, i have attached this profile thing at the bottom of my pom.xml (it looks like this: ......) – Andrzej Rehmann Jun 23 '15 at 17:52
  • 2
    @Hoto It should go inside inside —see [the POM reference](https://maven.apache.org/pom.html#Profiles). And [here](https://github.com/scijava/pom-scijava/blob/pom-scijava-7.4.1/pom.xml#L1695-L1801) is a real-world example. – ctrueden Jun 23 '15 at 18:28
20

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.

allprog
  • 16,540
  • 9
  • 56
  • 97
  • 1
    This worked great. I added the distributionManagement->repository tag to the pom for our local nexus repo and did a mvn deploy so it fixes it for my team. – Neil Wightman Jan 30 '17 at 08:27
  • What do you mean with "install this project"? what should I execute? – CptWasp Mar 05 '21 at 14:30
  • @CptWasp the command generates a new project. You need to install it in the local m2 repo with “mvn install” – allprog Mar 06 '21 at 21:35
19

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.

Andreas Sewe
  • 1,558
  • 9
  • 18
  • 4
    I want to upvote this answer 60 times, it's much neater than the old XML soup – batwad Jan 08 '19 at 15:36
  • 1
    While the `` appraoch from @ctrueden is great for all of us that are stuck with older Eclipse-versions - this answer so much! – Sebastian J. Apr 29 '19 at 18:04
  • 2
    Note that the above line marks the plugin for `execution, once, on project import`, which may not be what you want. The next likely option will probably be ``, which does what it says. There are a few more finely grained options available as well. – Torque Aug 06 '20 at 09:55
  • 3
    Please can you explain where should I put your code? I can't see any of the maven-processor-plugin in the example (and in my pom.xml) – CptWasp Mar 07 '21 at 13:49
9

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

Andrzej Rehmann
  • 12,360
  • 7
  • 39
  • 38
0

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)

Paŭlo Ebermann
  • 73,284
  • 20
  • 146
  • 210
Grzegorz Grzybek
  • 6,152
  • 3
  • 29
  • 42
  • When you store this in the settings, others will see this again, however. So for companies deploying to a thirdparty repository might be more feasible :-). – Mirko Friedenhagen Dec 08 '12 at 00:07
  • 3
    The quick fix you named adds the lifecycle-mapping configuration to the pom. This will *cause* the issue named by the question, not resolve it. – Kissaki Jan 14 '14 at 15:51
  • I agree with @Kissaki; this answer does not address the question being asked here. – ctrueden May 18 '14 at 22:02