1

I m getting this while I am running mvn test. I am using Jacoco for test coverage and added dependency for same in pom but getting this error:

[INFO] --- maven-surefire-plugin:2.12.4:test (default-test) @ qto-restAPI ---
[INFO] Tests are skipped.
[INFO] 
[INFO] --- jacoco-maven-plugin:0.8.3:report (post-unit-test) @ qto-restAPI ---
[INFO] Skipping JaCoCo execution due to missing execution data file.
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  44.053 s
[INFO] Finished at: 2021-08-11T16:19:22+05:30
[INFO] --------------------------------------------

This is my pom.xml:

<build>
  <finalName>qto-restAPI</finalName>
  <plugins>
    <plugin>
      <groupId>org.sonarsource.scanner.maven</groupId>
      <artifactId>sonar-maven-plugin</artifactId>
      <version>3.6.0.1398</version>
    </plugin>
    <plugin>
      <groupId>org.apache.maven.plugins</groupId>
      <artifactId>maven-surefire-plugin</artifactId>
      <version>2.13</version>
      <configuration>
        <source>1.8</source>
        <target>1.8</target>
        <debug>true</debug>
        <includes>
          <include>**/*Test.java</include>
          <include>**/*Tests.java</include>
        </includes>
        <excludes>
          <exclude>**/it/*IT.java</exclude>
        </excludes>
      </configuration>
    </plugin>
    <plugin>
      <groupId>org.jacoco</groupId>
      <artifactId>jacoco-maven-plugin</artifactId>
      <version>0.8.3</version>
      <executions>
        <execution>
          <id>default-prepare-agent</id>
          <goals>
            <goal>prepare-agent</goal>
          </goals>
        </execution>
        <execution>
          <id>jacoco-site</id>
          <phase>post-integration-test</phase>
          <goals>
            <goal>report</goal>
          </goals>
        </execution>
        <execution>
          <id>report</id>
          <phase>prepare-package</phase>
          <goals>
            <goal>report</goal>
          </goals>
        </execution>
        <execution>
          <id>post-unit-test</id>
          <phase>test</phase>
          <goals>
            <goal>report</goal>
          </goals>
          <configuration>
            <!-- Sets the path to the file which contains the execution data. -->
            <dataFile>target/jacoco.exec</dataFile>
            <!-- Sets the output directory for the code coverage report. -->
            <outputDirectory>target/my-reports</outputDirectory>
          </configuration>
        </execution>
      </executions>
      <configuration>
        <systemPropertyVariables>
          <jacoco-agent.destfile>target/jacoco.exec</jacoco-agent.destfile>
        </systemPropertyVariables>
      </configuration>
    </plugin>
  </plugins>
</build>

I have tried multiple times with, but this is not working. The classes I have also checked they are not xxxTests but xxxTest. Any other configuration that I am missing or what other thing can cause it? Please update if you know.

Mark Rotteveel
  • 100,966
  • 191
  • 140
  • 197
beingumang
  • 77
  • 2
  • 11
  • Could you please share the directory tree structure of your project? – Janez Kuhar Aug 11 '21 at 13:58
  • I was able to reproduce your error on an empty project. However, as soon as I added a single class and its test case, the error went away and `mvn test` generated a report. You may want to take a look at [this answer](https://stackoverflow.com/a/46660981/6367213) and another, [similar one](https://stackoverflow.com/a/33800421/6367213). – Janez Kuhar Aug 11 '21 at 14:03
  • 2
    Does this answer your question? [Getting "Skipping JaCoCo execution due to missing execution data file" upon executing JaCoCo](https://stackoverflow.com/questions/18107375/getting-skipping-jacoco-execution-due-to-missing-execution-data-file-upon-exec) – Janez Kuhar Aug 12 '21 at 09:01

0 Answers0