Domanda

When I try to import a maven project into eclispe juno I am getting the following error.jacoco maven error in eclipse.

I have the following lines in my pom.xml.

 </plugin>
      <plugin>
        <groupId>org.jacoco</groupId>
        <artifactId>jacoco-maven-plugin</artifactId>
        <version>0.6.3.201306030806</version>
        <configuration>
          <destfile>${basedir}/target/jacoco/jacoco.exec</destfile>
          <datafile>${basedir}/target/jacoco/jacoco.exec</datafile>
        </configuration>
        <executions>
          <execution>
            <id>jacoco-initialize</id>
            <goals>
              <goal>prepare-agent</goal>
            </goals>
          </execution>
          <execution>
            <id>jacoco-site</id>
            <phase>package</phase>
            <goals>
              <goal>report</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
    </plugins>

Why is maven giving this error? Any idea.

È stato utile?

Soluzione

The m2e plugin reports the error, because it can not find a m2e plugin that can handle the jacoco-maven-pluign configuration and execution within eclipse.

Thus the build on the command line via maven might lead to other results than the eclipse build.

You are using the jacoco-maven-plugin and I don't think it is necessarry to install a m2e plugin for jacoco.

You can either try to find a jacoco m2e adapter update site and install it or you move the jacoco-maven-plugin into a profile and only activate it when you need it.

EDIT

You can also tell the eclipse m2e plugin to ignore the jacoco-maven-plugin configuration. Add the follwing plugin configuration to the pluginManagement

<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.0.0,)</versionRange>
                                <goals>
                                    <goal>prepare-agent</goal>
                                    <goal>report</goal>
                                </goals>
                            </pluginExecutionFilter>
                            <action>
                                <ignore />
                            </action>
                        </pluginExecution>
                    </pluginExecutions>
                </lifecycleMappingMetadata>
            </configuration>
        </plugin>
    </plugins>
</pluginManagement>

This should work too.

You will find more information in the m2e documentation

Altri suggerimenti

Install EclEmma plugin from the marketplace and reload projects

  1. Right click on the Maven project.

  2. Hover over the Maven option.

  3. Choose update project.

Worked for me, Hope it helps you too.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top