No JaCoCo code coverage

Must-share information (formatted with Markdown):

  • Sonarqube v 8.3.1, SonarJava v 6.3.2, Jacoco v 1.1.0
  • Trying to get code coverage using the XML reports instead of the deprecated exec reports.

Hi everyone.

I had this same issue previously and wasn’t able to fix it. The solution then was to revert back to the older versions of the plugins so that Sonar would still receive the exec reports (https://community.sonarsource.com/t/re-sonar-code-coverage-at-0-after-upgrade-to-8-3/27275)

Now that the “Maven Pom.xml” Azure DevOps build step has been updated, I thought I would try get this working as expected again but I’m still having the same issue.

Can anyone tell me where/how the following is being inserted into the pom.xml file on build because it’s not in any of the modules pom.xml files at all…

<plugin>
    <groupId>org.jacoco</groupId>
    <artifactId>jacoco-maven-plugin</artifactId>
    <version>0.8.4</version>
    <configuration>
      <destFile>/data/AzureDevOpsAgents/A1/_work/60/s/CCReport43F6D5EF/jacoco.exec</destFile>
      <outputDirectory>/data/AzureDevOpsAgents/A1/_work/60/s/CCReport43F6D5EF</outputDirectory>
      <dataFile>/data/AzureDevOpsAgents/A1/_work/60/s/CCReport43F6D5EF/jacoco.exec</dataFile>
      <append>true</append>
      <includes>
        <include>**/com/engie/*/**</include>
      </includes>
      <excludes>
        <exclude>**/*/resources/*/**</exclude>
        <exclude>**/*/model/*/**</exclude>
      </excludes>
    </configuration>
    <executions>
      <execution>
        <configuration>
          <includes>
            <include>**/*</include>
          </includes>
        </configuration>
        <id>default-prepare-agent-vsts</id>
        <goals>
          <goal>prepare-agent</goal>
        </goals>
      </execution>
      <execution>
        <id>default-report-vsts</id>
        <goals>
          <goal>report</goal>
        </goals>
        <phase>test</phase>
      </execution>
    </executions>
  </plugin>

It doesn’t matter if I add my own declaration of that plugin in the pom.xml (I’ve tried with a different version and with the “destFile” set to a wildcard", it ALWAYS adds the above which is specifying the exec file instead of the xml file. I suspect it’s part of the build step somehow but I’m not able to confirm.

Thanks.
DB