quarkusio / quarkus

Quarkus: Supersonic Subatomic Java.
https://quarkus.io
Apache License 2.0
13.73k stars 2.67k forks source link

Quarkus Mutli module project Jacoco.xml only has the latest module results #42040

Open RickVerkuijlenMentech opened 3 months ago

RickVerkuijlenMentech commented 3 months ago

Describe the bug

I have a multi module project where I use Quarkus. In all the modules, I have written tests that all are succeeding. I want to see my code coverage in a self-hosted SonarQube instance. When I run ./mvnw verify, the target folder is being generated and is filled with the code coverage, all in different folders.

image

When using the jacoco.exec file in IntelliJ, I can see the fact that the code coverage does seem to work. But, since SonarQube doesn't support the binary format of Jacoco anymore, it needs to have the XML format. Example of jacoco.exec in IntelliJ

The XML format of Jacoco seems like it only has the last module in the generated list. This is shown in the CSV file that is generated with Jacoco. During the verify command, the CSV file changes the content to the module it is currently working on and overwrite the old ones. The content of the CSV file and the XML file do match.

CSV file generated by Jacoco

Expected behavior

Within in multi-module project, the XML file is overwritten with the module that it is building on that moment. Which means, at the end of the build, the XML file only holds code coverage information about the last in the build line.

Actual behavior

An XML file that is filled with all the modules code coverage in one file. This needs to be in one file because SonarQube only accepts one XML file as its code coverage source.

How to Reproduce?

  1. Have a multi module project with tests
  2. Use the guide for multi module projects: https://quarkus.io/guides/tests-with-coverage#working-with-multi-module-projects
  3. Check the CSV/XML file and there should only be one module result.

Output of uname -a or ver

No response

Output of java -version

OpenJDK Runtime Environment Temurin-21.0.3+9 (build 21.0.3+9-LTS)

Quarkus version or git rev

3.12.2

Build tool (ie. output of mvnw --version or gradlew --version)

Maven home: /Users/rickverkuijlen/.m2/wrapper/dists/apache-maven-3.9.6-bin/3311e1d4/apache-maven-3.9.6 Java version: 21.0.3, vendor: Eclipse Adoptium, runtime: /Users/rickverkuijlen/.sdkman/candidates/java/21.0.3-tem Default locale: en_NL, platform encoding: UTF-8 OS name: "mac os x", version: "14.5", arch: "aarch64", family: "mac"

Additional information

No response

RickVerkuijlenMentech commented 6 days ago

bump