1

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>

2 Answers 2

2

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

Sign up to request clarification or add additional context in comments.

3 Comments

additional arguments for Surefire are definitely not needed
When I don't add the surefire argument Jenkins seems not to find the Jacoco package :( Did I do something wrong ? ._.
I have the same issue, Depado. have you figured that out?
1

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>

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.