Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Skipping JaCoCo execution due to missing execution data error

I am getting

Skipping JaCoCo execution due to missing execution data file:/scratch/jenkins/workspace/sonar-test/target/jacoco.exec error

My pom profile is:

    <profile>
        <id>test-coverage</id>
        <build>
            <plugins>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-surefire-plugin</artifactId>
                    <version>${maven.surefire.plugin.version}</version>
                    <configuration combine.self="override">
                        <redirectTestOutputToFile>true</redirectTestOutputToFile>
                        <testFailureIgnore>true</testFailureIgnore>
                           <groups>com.project.test.annotation.QuickTest</groups>
                    </configuration>
                </plugin>
                <plugin>
                    <groupId>org.jacoco</groupId>
                    <artifactId>jacoco-maven-plugin</artifactId>
                    <version>0.7.1.201405082137</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>
                </plugin>

            </plugins>
        </build>
    </profile>

What am I missing?

like image 364
Bilal Yasar Avatar asked Aug 18 '14 23:08

Bilal Yasar


People also ask

What is JaCoCo execution data file?

Jacoco Execution data file is a jacoco. exec file which is generated when prepare agent goal is running. When It isn't generated or the correct path isn't set in configuration, you will get that error message. Because Jacoco use It to build test coverage.

Why does JaCoCo not show coverage?

Why does the coverage report not show line coverage figures? JaCoCo is based on class files analysis. To calculate line coverage class files must contain line number attributes. For this your code must be compiled with debug information.

How do I exclude a class from JaCoCo code coverage?

Starting from JaCoCo 0.8. 2, we can exclude classes and methods by annotating them with a custom annotation with the following properties: The name of the annotation should include Generated. The retention policy of annotation should be runtime or class.


1 Answers

Another reason for missing jacoco.exec can be that there aren't any unit tests in project.

Edit: I would like to know, why my answer was voted down since nobody left any reason in comments. We had the same error message in project consisting of 3 sub-projects. One of them was new and without any tests - after adding one dummy unit test error was gone.

like image 157
Korri Avatar answered Sep 27 '22 22:09

Korri