12
votes

I’m using Eclipse Kepler on Mac 10.9.5. I have imported a number of Maven projects using the m2e Eclipse plugin. All these projects are children of a parent pom. When I look at the “Overview” in the individual child pom.xml files, I see stuff like this:

Plugin execution not covered by lifecycle configuration: org.codehaus.mojo:properties-maven-plugin:1.0-alpha-2:write-project-properties (execution: default, phase: process-resources)

I would like Eclipse to execute these lifecycle phases at the appropriate times, but I’m not sure how to do that. When I select Eclipse’s suggestion …

Permanently mark goal write-project-properties in pom.xml as ignore

I selected the parent pom.xml file when prompted “Select location to place ignore,” however, the error does not go away when I view the child pom.xml file in the Eclipse editor. How can I map lifecycle phases not covered by m2e?

Edit:

Per the answer, I went to Eclipse -> Preferences -> Maven -> Lifecycle Mappings, clicked on "Open Workspace Lifecycle Mappings Metadata", and edited the file as suggested ...

<?xml version="1.0" encoding="UTF-8"?>
<lifecycleMappingMetadata>
    <pluginExecutions>
        <pluginExecution>
            <pluginExecutionFilter>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>xmlbeans-maven-plugin</artifactId>
                <versionRange>2.3.3</versionRange>
                <goals>
                    <goal>xmlbeans</goal>
                </goals>
            </pluginExecutionFilter>
            <action>
                <ignore />
            </action>
        </pluginExecution>
        <pluginExecution>
            <pluginExecutionFilter>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>properties-maven-plugin</artifactId>
                <versionRange>[1.0-alpha-2,)</versionRange>
                <goals>
                    <goal>write-project-properties</goal>
                </goals>
            </pluginExecutionFilter>
            <action>
                <execute />
            </action>
        </pluginExecution>
    </pluginExecutions>
</lifecycleMappingMetadata>

Even after restarting Eclipse, when I open a child pom.xml file, the "Plugin execution not covered by lifecycle configuration" errors remain as before.

1
I think you can find the answer in this questions/answers : stackoverflow.com/questions/6352208/…Fabien
I"m not using the aspectj-maven-plugin though.Dave

1 Answers

14
votes

M2Eclipse (the Maven integration plugin for Eclipse) is mapping and execution the default phases and goals of Maven into the internal Eclipse build workflow.

See: https://www.eclipse.org/m2e/documentation/m2e-execution-not-covered.html

[...] requires explicit instructions what to do with all Maven plugins bound to “interesting” phases [...] 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.

It is possible to solve this errors in every project or in your global Eclipse installation.

Project build lifecycle mapping can be configured in a project’s pom.xml, contributed by Eclipse plugins, or defaulted to the commonly used Maven plugins shipped with m2e. We call these “lifecycle mapping metadata sources”.

The global Eclipse setting file is called lifecycle-mapping-metadata.xml and configurable via the 'Lifecycle Mappings' at the Maven Settings dialog[1].

M2Eclipse matches plugin executions to actions using combination of plugin groupId, artifactId, version range and goal. There are three basic actions that M2Eclipse can be instructed to do with a plugin execution – ignore, execute and delegate to a project configurator.

[...]

The ignore option, as the name suggests, tells M2Eclipse to silently ignore the plugin execution.

[...]

The execute option tells m2e to execute the action as part of Eclipse workspace full or incremental build.

delegate to a project configurator means there are adapter Eclipse plugins in the Eclipse Marketplace. A adapter plugin executes the phases and goals in a more Maven plugin specific way.

The real settings (the XML structure) isn't real intuitive but a bit described in the link above.

In your case the lifecycle-mapping-metadata.xml will be looks like:

<?xml version="1.0" encoding="UTF-8"?>
<lifecycleMappingMetadata>
  <pluginExecutions>
[...]
    <pluginExecution>
      <pluginExecutionFilter>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>properties-maven-plugin</artifactId>
        <versionRange>[1.0-alpha-2,)</versionRange>
        <goals>
          <goal>write-project-properties</goal>
        </goals>
      </pluginExecutionFilter>
      <action>
        <ignore />
      </action>
    </pluginExecution>
[...]
  </pluginExecutions>
</lifecycleMappingMetadata>

ProTip: Did you have more projects and use a set of Maven plugins all the time, move the lifecycle-mapping-metadata.xml in SCM (git, svn, cvs ...).

EDIT

Add all goals of a plugin and maybe additional plugins to avoid these errors. Read the error message carefully for additional goals or plugins.

After any saved change of lifecycle-mapping-metadata.xml you have to reload the content in the Maven Settings dialog[1] and update all Maven based projects in the workspace.

Click the right mouse button on a Maven project in your Workspace and choose Maven > Update Projects .... Select the/all Maven Projects and activate the following checkboxes:

  • Update project configuration from pom.xml
  • Refresh workspace resources from local filesystem
  • Clean projects

EDIT

[1] The Maven Settings dialog was located at File > Window > Preferences > Maven > Lifecycle Mappings until Exclipse Oxygen.