I am trying to enable report-aggregate
for all modules in a maven multi-module project. My project structure is like below
/pom.xml
/module-a/pom.xml
/module-b/pom.xml
/module-c/pom.xml
/coverage/pom.xml
I have created a new aggregation called coverage
module and added all main modules as its dependencies.
The reactor pom.xml looks like below
<project>
<groupId>de.qaware.example</groupId>
<artifactId>reactor</artifactId>
<packaging>pom</packaging>
<properties>
<sonar.coverage.jacoco.xmlReportPaths>
${project.basedir}/../coverage/target/site/jacoco-aggregate/jacoco.xml,
${project.basedir}/../../coverage/target/site/jacoco-aggregate/jacoco.xml,
</sonar.coverage.jacoco.xmlReportPaths>
</properties>
<modules>
<module>module-a</module>
<module>module-b</module>
<module>module-c</module>
<module>coverage</module>
</modules>
<!-- ... more XML, like plugin management ... -->
<build>
<plugins>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>${jacoco.plugin.version}</version>
<configuration>
<excludes>
<exclude>**/codegen/**/*</exclude>
<exclude>**/dto/**/*</exclude>
</excludes>
</configuration>
<executions>
<execution>
<goals>
<goal>prepare-agent</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
My coverage pom.xml looks like below
<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>
Relevant build logs
2022-06-11T09:44:14.4567283Z [INFO] --- jacoco-maven-plugin:0.8.8:prepare-agent (default) @ module-a ---
2022-06-11T09:44:14.4568168Z [INFO] argLine set to -javaagent:/root/.m2/repository/org/jacoco/org.jacoco.agent/0.8.8/org.jacoco.agent-0.8.8-runtime.jar=destfile=/codebuild/output/src344993998/src/github.com/sp-Tech/sp/src/java/assets/target/jacoco.exec,excludes=**/codegen/**/*:**/dto/**/*
<!-- Similarly for module-b and module-c -->
But I am also seeing this
2022-06-11T12:48:58.5133817Z [INFO] Coverage report doesn't exist for pattern: '/codebuild/output/src254694416/src/github.com/sp-Tech/sp/src/java/dir/module-b/../coverage/target/site/jacoco-aggregate/jacoco.xml'
2022-06-11T12:48:58.5134830Z [INFO] Coverage report doesn't exist for pattern: '/codebuild/output/src254694416/src/github.com/sp-Tech/spotnana/src/java/dir/module-b/../../coverage/target/site/jacoco-aggregate/jacoco.xml'
I am not seeing the coverage information for module-b
.
Sonar Qube Developer Version 9.2
I have referred the below links for reference
Can someone let me know what I am doing wrong?