Maven multimodule project based on Java 17
- SonarQube Server (Community Build - v25.5.0.107428)
- sonar plugin version: 3.11.0.3922
- jacoco plugin version: 0.8.11
- SonarQube deployed: Docker
- in root pom.xml is set:
<sonar.coverage.jacoco.xmlReportPaths>${project.basedir}/server-jacoco-report/target/site/jacoco-aggregate/jacoco.xml</sonar.coverage.jacoco.xmlReportPaths> - in report module is set:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>business-server</artifactId>
<groupId>com.company.server</groupId>
<version>2.1.19-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>server-jacoco-report</artifactId>
<version>2.1.19-SNAPSHOT</version>
<packaging>pom</packaging>
<build>
<plugins>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>${jacoco.plugin.version}</version>
<executions>
<execution>
<id>report-aggregate</id>
<phase>verify</phase>
<goals>
<goal>report-aggregate</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
<!-- Needed for getting reports from given modules -->
<dependencies>
analyzed modules
</dependencies>
</project>
In each analyzed module pom.xml is set
<build>
<plugins>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<executions>
<execution>
<id>prepare-agent</id>
<goals>
<goal>prepare-agent</goal>
</goals>
<phase>initialize</phase>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
</plugin>
</plugins>
</build>
The sonar/jacoco analysis is processed successfully but code coverage in SQ server is always 0%, expected ca 11% as in ./server-jacoco-report/target/site/jacoco-aggregate/index.html