3

I'm trying to create a jacoco report on my project. The project is in java 12 version and the jacoco-maven-plugin is on version 0.8.5.

            <plugin>
                <groupId>org.jacoco</groupId>
                <artifactId>jacoco-maven-plugin</artifactId>
                <version>0.8.5</version>
                <executions>
                    <execution>
                        <id>pre-unit-test</id>
                        <goals>
                            <goal>prepare-agent</goal>
                        </goals>
                    </execution>
                    <execution>
                        <id>post-unit-test</id>
                        <phase>test</phase>
                        <goals>
                            <goal>report</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

I launch a mvn clean site

mvn clean install site

And I obtain:

[INFO] --- jacoco-maven-plugin:0.8.5:prepare-agent (pre-unit-test) @ bowling-game ---
[INFO] argLine set to -javaagent:/home/baptiste/.m2/repository/org/jacoco/org.jacoco.agent/0.8.5/org.jacoco.agent-0.8.5-runtime.jar=destfile=/home/baptiste/IdeaProjects/Bowling-Game/target/jacoco.exec

...
[INFO] --- maven-surefire-plugin:2.22.1:test (default-test) @ bowling-game ---
[INFO] 
[INFO] -------------------------------------------------------
[INFO]  T E S T S
[INFO] -------------------------------------------------------
[INFO] Running com.keywer.kata.bowling.game.frame.state.FrameStateTest
[INFO] Tests run: 5, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.064 s - in com.keywer.kata.bowling.game.frame.state.FrameStateTest
[INFO] Running com.keywer.kata.bowling.game.BowlingGameTest
[INFO] Tests run: 6, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0 s - in com.keywer.kata.bowling.game.BowlingGameTest
...
[INFO] --- jacoco-maven-plugin:0.8.5:report (post-unit-test) @ bowling-game ---
[INFO] Skipping JaCoCo execution due to missing execution data file.

I'm looking for the report but indeed it was not created, due to the following line:
[INFO] Skipping JaCoCo execution due to missing execution data file.

What I have forget ?

1 Answer 1

6

My project is write in java 12 version and I enabled preview feature like this.

<plugin>
    <artifactId>maven-surefire-plugin</artifactId>
    <version>2.22.1</version>
    <configuration>
      <argLine>--enable-preview</argLine> <=== This line
    </configuration>
</plugin>

The issue was that maven was not able to generate jacoco.exec.

I find the awnser thanks to @Jacek Laskowski with this comment https://stackoverflow.com/a/23605812/8591625

I just replace by

<plugin>
    <artifactId>maven-surefire-plugin</artifactId>
    <version>2.22.1</version>
    <configuration>
       <argLine>${argLine} --enable-preview</argLine> <=== Here I adding ${argLine} in order to not override argument
    </configuration>
</plugin>
Sign up to request clarification or add additional context in comments.

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.