1

Hello all I am getting below maven build error in eclipse:I am using Maven 3.3, Java7, Kepler Eclipse 2.0.2. Can anybody help me.

Plugin execution not covered by lifecycle configuration: org.jacoco:jacoco-maven-plugin:0.7.2.201409121644:prepare-agent (execution: default, phase: initialize).

pom.xml

    <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
             xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
        <modelVersion>4.0.0</modelVersion>

        <groupId>com.siemens.fossology.test</groupId>
        <artifactId>ui-test</artifactId>
        <version>1.0-SNAPSHOT</version>
        <packaging>jar</packaging>

        <name>ui-test</name>
        <url>http://maven.apache.org</url>

        <properties>
            <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

            <main.class>com.siemens.fossology.test.ui.StartUp</main.class>

            <java.version>1.7</java.version>
            <config-builder.version>1.3.1</config-builder.version>
            <testng.version>6.1.1</testng.version>
            <guava.version>18.0</guava.version>
            <slf4j.version>1.7.7</slf4j.version>
            <logback.version>1.1.2</logback.version>
            <mockito.version>1.10.8</mockito.version>
            <hamcrest.version>1.3</hamcrest.version>
            <selenium-java.version>2.43.1</selenium-java.version>
            <xml-apis.version>1.4.01</xml-apis.version>

            <maven-compiler-plugin.version>3.3</maven-compiler-plugin.version>
            <maven-jar-plugin.version>2.5</maven-jar-plugin.version>
            <maven-assembly-plugin.version>2.4</maven-assembly-plugin.version>
            <maven-shade-plugin.version>2.3</maven-shade-plugin.version>

        </properties>

        <dependencies>
            <dependency>
                <groupId>com.tngtech.java</groupId>
                <artifactId>config-builder</artifactId>
                <version>${config-builder.version}</version>
            </dependency>
            <dependency>
                <groupId>org.testng</groupId>
                <artifactId>testng</artifactId>
                <version>${testng.version}</version>
            </dependency>
            <dependency>
                <groupId>com.google.guava</groupId>
                <artifactId>guava</artifactId>
                <version>${guava.version}</version>
            </dependency>
            <dependency>
                <groupId>org.slf4j</groupId>
                <artifactId>slf4j-api</artifactId>
                <version>${slf4j.version}</version>
            </dependency>
            <dependency>
                <groupId>ch.qos.logback</groupId>
                <artifactId>logback-classic</artifactId>
                <version>${logback.version}</version>
            </dependency>
            <dependency>
                <groupId>ch.qos.logback</groupId>
                <artifactId>logback-core</artifactId>
                <version>${logback.version}</version>
            </dependency>
            <dependency>
                <groupId>org.hamcrest</groupId>
                <artifactId>hamcrest-all</artifactId>
                <version>${hamcrest.version}</version>
            </dependency>
            <dependency>
                <groupId>org.mockito</groupId>
                <artifactId>mockito-all</artifactId>
                <version>${mockito.version}</version>
            </dependency>
            <dependency>
                <groupId>org.seleniumhq.selenium</groupId>
                <artifactId>selenium-java</artifactId>
                <version>${selenium-java.version}</version>
            </dependency>
            <dependency>
                <groupId>xml-apis</groupId>
                <artifactId>xml-apis</artifactId>
                <version>${xml-apis.version}</version>
            </dependency>
        </dependencies>

        <build>
            <pluginManagement>
                <plugins>
                    <plugin>
                        <groupId>org.jacoco</groupId>
                        <artifactId>jacoco-maven-plugin</artifactId>
                        <version>0.7.2.201409121644</version>
                        <executions>
                            <execution>
                                <goals>
                                    <goal>prepare-agent</goal>
                                </goals>
                            </execution>
                            <execution>
                                <id>report</id>
                                <phase>prepare-package</phase>
                                <goals>
                                    <goal>report</goal>
                                </goals>
                            </execution>
                        </executions>
                        <configuration>
                            <excludes>
                                <exclude>org/xmlsoap/schemas/**</exclude>
                                <exclude>org/apache/ws/commons/schema/**</exclude>
                            </excludes>
                        </configuration>
                    </plugin>
                </plugins>
            </pluginManagement>
            <plugins>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-compiler-plugin</artifactId>
                    <version>${maven-compiler-plugin.version}</version>
                    <configuration>
                        <source>${java.version}</source>
                        <target>${java.version}</target>
                    </configuration>
                </plugin>

                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-jar-plugin</artifactId>
                    <version>${maven-jar-plugin.version}</version>
                    <configuration>
                        <archive>
                            <manifest>
                                <addClasspath>true</addClasspath>
                                <mainClass>${main.class}</mainClass>
                            </manifest>
                        </archive>
                    </configuration>
                </plugin>

                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-assembly-plugin</artifactId>
                    <version>${maven-assembly-plugin.version}</version>
                    <configuration>
                        <descriptorRefs>
                            <descriptorRef>jar-with-dependencies</descriptorRef>
                        </descriptorRefs>
                        <archive>
                            <manifest>
                                <mainClass>${main.class}</mainClass>
                            </manifest>
                        </archive>
                    </configuration>
                </plugin>

                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-shade-plugin</artifactId>
                    <version>${maven-shade-plugin.version}</version>
                    <executions>
                        <execution>
                            <phase>package</phase>
                            <goals>
                                <goal>shade</goal>
                            </goals>
                            <configuration>
                                <transformers>
                                    <transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
                                        <mainClass>${main.class}</mainClass>
                                    </transformer>
                                    <transformer implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
                                        <resource>META-INF/spring.handlers</resource>
                                    </transformer>
                                    <transformer implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
                                        <resource>META-INF/spring.schemas</resource>
                                    </transformer>
                                    <transformer implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
                                        <resource>META-INF/spring.tooling</resource>
                                    </transformer>
                                </transformers>
                                <shadedArtifactAttached>true</shadedArtifactAttached>
                                <shadedClassifierName>with-dependencies</shadedClassifierName>
                            </configuration>
                        </execution>
                    </executions>
                </plugin>
                <plugin>
                    <groupId>org.jacoco</groupId>
                    <artifactId>jacoco-maven-plugin</artifactId>
                </plugin>
            </plugins>
        </build>
    </project>

I think this will only address prepare-agent issue. How about achieving remaining goals like report and prepare-package. Can anybody please address(attached answer)

Vinod Hejib
  • 147
  • 1
  • 4
  • 13
  • 3
    Possible duplicate of [How to solve "Plugin execution not covered by lifecycle configuration" for Spring Data Maven Builds](http://stackoverflow.com/questions/6352208/how-to-solve-plugin-execution-not-covered-by-lifecycle-configuration-for-sprin) – Tunaki Oct 13 '15 at 09:20
  • Can you please tell me how i can add below pom content in my pom.xml maintaining report, prepare package and other configurations. – Vinod Hejib Oct 13 '15 at 10:20
  • I think this will only address prepare-agent issue. How about achieving remaining goals like report and prepare-package. Can anybody please address. – Vinod Hejib Oct 13 '15 at 10:27

3 Answers3

3

Adding plugin EclEmma (java Code Coverage)in Kepler Eclipse has solved my problem.

Vinod Hejib
  • 147
  • 1
  • 4
  • 13
2

Add in 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.jacoco</groupId>
                                    <artifactId>jacoco-maven-plugin</artifactId>
                                    <versionRange>[0.7.2.201409121644,)</versionRange>
                                    <goals>
                                        <goal>prepare-agent</goal>
                                    </goals>
                                </pluginExecutionFilter>
                                <action>
                                    <ignore />
                                </action>
                            </pluginExecution> 
                        </pluginExecutions>
                    </lifecycleMappingMetadata>
                </configuration>
            </plugin>  

question_maven_com
  • 2,457
  • 16
  • 21
0

I had the same issue on java 8 and maven 3.6.0, I increased the version of jacoco-maven-plugin from 0.7.2.201409121644 to 0.7.9 and the problem was gone.