3

Recently I have imported a maven project in eclipse oxygen. My build are success but while in pom.xml in tag I am getting some error.The error is

"Plugin execution not covered by lifecycle configuration: org.codehaus.mojo:flatten-maven-plugin:1.1.0:flatten (execution: flatten, phase: process-resources) "

Could anyone please help.Thanks in advance

Ichigo Kurosaki
  • 3,765
  • 8
  • 41
  • 56
Ashok
  • 31
  • 1
  • 3
  • See also: https://stackoverflow.com/questions/44027620/what-is-this-maven-error-plugin-execution-not-covered-by-lifecycle-configurat – Aaron Digulla Jun 30 '20 at 14:06

3 Answers3

9

This is not an error per se. This is due to how m2eclipse plugin works.

In short, Eclipse's plugin does not execute the maven lifecycle the same way it happens on the command line. It needs to "control" the build in order to:

  • compile the project itself instead of using Maven
  • update the UI accordingly
  • update project's settings
  • ...

But it can not know upfront what every single Maven plugin does and does it make sense to execute it. Attempts to run everything in such non typical Maven build process, often result in many problems. Thus the decision to introduce “project build lifecycle mapping”:

To solve these long-standing issues, M2Eclipse 1.0 requires explicit instructions what to do with all Maven plugins bound to “interesting” phases (see [M2E interesting lifecycle phases](M2E interesting lifecycle phases “wikilink”)) of a project build lifecycle. We call these instructions “project build lifecycle mapping” or simply “lifecycle mapping” because they define how m2e maps information from project pom.xml file to Eclipse workspace project configuration and behaviour during Eclipse workspace build.

So, the message you have, means that M2Eclipse was not provided with “project build lifecycle mapping” for the org.codehaus.mojo:flatten-maven-plugin:1.1.0:flatten plugin execution. Depending on your usage of that plugin, you can configure M2Eclipse to Ignore Plugin Goal or Execute Plugin Goal.

Milen Dyankov
  • 2,972
  • 14
  • 25
  • 1
    The best and easiest syntax for Eclipse is described here: https://www.eclipse.org/m2e/documentation/release-notes-17.html#new-syntax-for-specifying-lifecycle-mapping-metadata – Francois Marot Feb 10 '20 at 11:52
  • Thanks following the link you send i managed to create a plugin management entry specifically for . i added an answer below based on the link where i filled the actual values needed for flatten plugin. – thedrs May 11 '20 at 11:53
1

You could downgrade the severity of the error markers to “warnings” since they don’t impact the maven builds. Under window->preferences->maven->errors

1

So i went with the link Milen dyankov showed in his answer, there was a template of a plugin management part to add to the parent pom. I filled the template with the values (goal,groupId,....) of flatten and now it does not color red in eclipse for the child poms and does not give the error.

Add this to the parent pom:

    <pluginManagement>
         <plugins>
             <plugin>
                <groupId>org.eclipse.m2e</groupId>
                <artifactId>lifecycle-mapping</artifactId>
                <version>1.0.0</version>
                <configuration>
                    <lifecycleMappingMetadata>
                        <pluginExecutions>
                            <pluginExecution>
                                <pluginExecutionFilter>
                                    <groupId>org.codehaus.mojo</groupId>
                                    <artifactId>flatten-maven-plugin</artifactId>
                                    <versionRange>[1.0.0,)</versionRange>
                                    <goals>
                                        <goal>flatten</goal>
                                    </goals>
                                </pluginExecutionFilter>
                                <action>
                                    <execute>
                                        <runOnIncremental>false</runOnIncremental>
                                    </execute>
                                </action>
                            </pluginExecution>
                        </pluginExecutions>
                    </lifecycleMappingMetadata>
                </configuration>
            </plugin>
        </plugins>
    </pluginManagement>
thedrs
  • 1,412
  • 12
  • 29
  • 1
    Thanks! I also needed to update the flatten-maven-plugin (from 1.1.0 to 1.2.5) to fix [this bug](https://github.com/mojohaus/flatten-maven-plugin/issues/59) in Eclipse that came up after adding your snippet into the POM. – Ingo Karkat May 16 '22 at 10:51