Gonen I
Gonen I

Reputation: 6127

Eclipse m2e fail where maven build succeeds - due to plugin execution not covered by lifecycle?

I have a project where maven build from eclipse m2e fails, but mvn clean install from the command line succeeds.

Its a multi module project ( parent and children ) which defines several custom executions.

I think the problem may be the result of several plugins showing errors of type "Plugin execution not covered by lifecycle configuration".

Furthermore upon import of the project a dialog comes up called "Setup Maven plugin connectors" and shows the goals with the custom executions as having no market place entries to handle them.

uncoved goals

I have read

How to solve "Plugin execution not covered by lifecycle configuration" for Spring Data Maven Builds

and used "ignore" on the errors in eclipse maven preferences, which makes the errors go away, but the project is apparently not built correctly. Is there a more appropriate solution?

Here are shortened poms showing example of an uncovered goal. The parent pom defines a custom compile goal execution called compile_with_aspectj

<project xmlns=...xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>groupid</groupId>
    <artifactId>parent-module</artifactId>
    <version>1.0.0-SNAPSHOT</version>
    <packaging>pom</packaging>

<dependencyManagement>
    <dependencies>
        <dependency>
            <groupId>groupid</groupId>
            <artifactId>child-module-1</artifactId>
            <version>${project.version}</version>
            <type>pom</type>
        </dependency>
</dependencyManagement>

<build>
    <pluginManagement>
        <plugins>
             <plugin>
                <groupId>com.nickwongdev</groupId>
                <artifactId>aspectj-maven-plugin</artifactId>
                <configuration>
                    <complianceLevel>11</complianceLevel>
                    <includes>
                        <include>**/*.java</include>
                        <include>**/*.aj</include>
                    </includes>
                    <showWeaveInfo>true</showWeaveInfo>
                    <forceAjcCompile>true</forceAjcCompile>
                    <Xlint>ignore</Xlint>
                    <sources/>
                    <weaveDirectories>
                        <weaveDirectory>${project.build.directory}/classes</weaveDirectory>
                    </weaveDirectories>
                </configuration>
                <executions>
                    <execution>
                        <id>compile_with_aspectj</id>
                        <goals>
                            <goal>compile</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

which then produces the following error in eclipse m2e

Plugin execution not covered by lifecycle configuration: com.nickwongdev:aspectj-maven-plugin:1.12.6:compile (execution: compile_with_aspectj, phase: compile) pom.xml /child-module-1 line 7 Maven Project Build Lifecycle Mapping Problem

where the child pom looks something like

 <project xmlns=..../xsd">
    <modelVersion>4.0.0</modelVersion>
    <artifactId>child-module-1</artifactId>
    <name>${project.groupId}:${project.artifactId}</name>
    <description> </description>
    <parent>
        <groupId>groupid</groupId>
        <artifactId>parent-module</artifactId>
        <version>1.0.0-SNAPSHOT</version>
        <relativePath>../parent-module</relativePath>
    </parent>
    <dependencies>
     ...
    </dependencies>
    <build>
        <plugins>
            <plugin>
                <groupId>com.nickwongdev</groupId>
                <artifactId>aspectj-maven-plugin</artifactId>
            </plugin>
        </plugins>
    </build>

Does anyone know if m2e has a problem building projects with custom execution steps or with multi module projects?

Upvotes: 0

Views: 418

Answers (1)

Geetha
Geetha

Reputation: 1

Providing lifecycle metadata inside the execution node resolved similar error in eclipse in my case.

<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.8</version>
<executions>
    <execution>
        <?m2e execute?>
        <id>generate-sources</id>
    </execution>
</executions>

Refer this for other lifecycle mapping options.

Upvotes: 0

Related Questions