Derek
Derek

Reputation: 51

Whenever I build a Maven project the pom file has a lifecycle configuration error,why?

I am a noob in m2e and Maven things.I am now tring to bulid a Maven project in eclipse, so I have a M2E plugin installed.However, whenever I build a new Maven project, the initial completely new project has a red cross in the pom file.I checked it and it always happening in the packaging line, I never customize that in building the new project so I should be war, but the error says
"Plugin execution not covered by lifecycle configuration: org.apache.maven.plugins:maven-resources-plugin:2.4.3:resources (execution: default-resources, phase: process-resources)" and "Plugin execution not covered by lifecycle configuration: org.apache.maven.plugins:maven-resources-plugin:2.4.3:testResources (execution: default-testResources, phase: process-test-resources)-<packaging>war</packaging>"

Can you please provide some hints about how to fix this? Thanks.

I tried to build from different types of archetypes but the error is the same.

Upvotes: 0

Views: 2914

Answers (1)

Gerard Ribas
Gerard Ribas

Reputation: 727

See: http://wiki.eclipse.org/M2E_plugin_execution_not_covered

To solve some long-standing issues, m2e 1.0 requires explicit instructions what to do with all Maven plugins bound to "interesting" phases (see M2E interesting lifecycle phases) of 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.

Project build lifecycle mapping configuration can be specified in project pom.xml, contributed by Eclipse plugins and there is also default configuration for some commonly used Maven plugins shipped with m2e. We call these "lifecycle mapping metadata sources". m2e will create error marker like below for all plugin executions that do not have lifecycle mapping in any of the mapping metadata sources.

Plugin execution not covered by lifecycle configuration: org.apache.maven.plugins:maven-antrun-plugin:1.3:run (execution: generate-sources-input, phase: generate-sources) m2e matches plugin executions to actions using combination of plugin groupId, artifactId, version range and goal. There are three basic actions that m2e can be instructed to do with a plugin execution -- ignore, execute and delegate to a project configurator.

<build>
<pluginManagement>
    <plugins>
        <!-- Ignore/Execute plugin execution -->
        <!-- this is to eliminate eclipse import errors -->
        <plugin>
            <groupId>org.eclipse.m2e</groupId>
            <artifactId>lifecycle-mapping</artifactId>
            <version>1.0.0</version>
            <configuration>
                <lifecycleMappingMetadata>
                    <pluginExecutions>
                    <!-- copy-dependency plugin -->
                        <pluginExecution>
                            <pluginExecutionFilter>
                                <groupId>org.apache.maven.plugins</groupId>
                                <artifactId>maven-resources-plugin</artifactId>
                                <versionRange>[2.4.3,)</versionRange>
                                <goals>
                                    <goal>resources</goal>
                                    <goal>testResources</goal>
                                </goals>
                            </pluginExecutionFilter>
                            <action>
                                <ignore />
                            </action>
                        </pluginExecution>
                    </pluginExecutions>
                </lifecycleMappingMetadata>
            </configuration>
         </plugin>
    </plugins>
</pluginManagement>

You can see more info here: http://deepaksrivastav.com/?p=155

Upvotes: 2

Related Questions