Domanda

Just wanted to know if it's usefull to start the jacoco agent using the maven plugin and to add some arguments to surefire ? Does it start Jacoco twice ?

Example :

        <plugin>
            <groupId>org.jacoco</groupId>
            <artifactId>jacoco-maven-plugin</artifactId>
            <version>${jacoco.version}</version>
            <executions>
                <execution>
                    <phase>pre-integration-test</phase>
                    <goals>
                        <goal>prepare-agent</goal>
                    </goals>
                </execution>
            </executions>           
        </plugin>

And

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<argLine>-javaagent:${sonar.jacoco.jar}=destfile='${sonar.jacoco.reportPath}'</argLine>
È stato utile?

Soluzione

They provide Maven usage example, so it seems additional arguments for Surefire are not needed.

Altri suggerimenti

I don't know what your ${jacoco.version} is, but the following snippet worked for me.

You don't need to provide additional arguments for the surefire plugin.

The version has to be one that is declared in the Maven Repository( Assuming that you didn't install the dependency locally or use some other/custom repository):

        <plugin>
            <groupId>org.jacoco</groupId>
            <artifactId>jacoco-maven-plugin</artifactId>
            <version>0.5.7.201204190339</version>
            <executions>
                <execution>
                    <id>jacoco-initialize</id>
                    <goals>
                        <goal>prepare-agent</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top