Skip to content

Jacoco Report not generated when maven-surefire-plugin is added to parent pom #40944

Open

Description

Describe the bug

Most of our repos are structured as multi-module repos. Some modules are quarkus-services, some are only libs which are shared between the quarkus-services. Every module had the jacoco-maven-plugin and I want to migrate to the quarkus-jacoco plugin. Additionally we have a sonarqube instance which reports our test coverage.

I have some issues during migration (not finding tests for example) therefore I tried it with a minimal project setup, which can be found here: https://github.com/hamburml/multi-module-test-coverage and it works - for each module. After mvn verify I find all reports located in target/jacoco-report (which I think I will change to target/site because that is the defacto default location if I remember. I need to make sure that sonarqube finds the report).

But now I want to aggregate every report to a big "repository report". I used https://quarkus.io/guides/tests-with-coverage#working-with-multi-module-projects the following config, pasted it in the parent pom and after mvn verify all reports are gone.

Expected behavior

every module should have a target/jacoco-report folder and the parent target/coverage folder should be aggregated module reports.

Actual behavior

After

    <build>
        <plugins>
            <plugin>
                <artifactId>maven-surefire-plugin</artifactId>
                <configuration>
                    <systemPropertyVariables>
                        <quarkus.jacoco.data-file>${maven.multiModuleProjectDirectory}/target/jacoco.exec</quarkus.jacoco.data-file>
                        <quarkus.jacoco.reuse-data-file>true</quarkus.jacoco.reuse-data-file>
                        <quarkus.jacoco.report-location>${maven.multiModuleProjectDirectory}/target/coverage</quarkus.jacoco.report-location>
                    </systemPropertyVariables>
                </configuration>
            </plugin>
        </plugins>
    </build>

is added to the parent pom all reports are gone

How to Reproduce?

  1. clone https://github.com/hamburml/multi-module-test-coverage
  2. mvn verify
  3. check reports
  4. add maven-surefire-plugin to parent-pom as shown in guide https://quarkus.io/guides/tests-with-coverage#working-with-multi-module-projects
  5. mvn verify
  6. reports gone

Output of uname -a or ver

No response

Output of java -version

No response

Quarkus version or git rev

No response

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

No response

Additional information

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions