0

I have a project with multiple modules.

  • module1
  • module2
  • module3
  • testModule:
    • src/main/java:
      • com.example.test
        • some legacy I cannot get rid of
    • src/test/java:
      • com.example.test:
        • actual test classes pom.xml (in testModule)

pom.xml(root pom)

content of testModule pom:

<build>
        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>org.sonarsource.scanner.maven</groupId>
                    <artifactId>sonar-maven-plugin</artifactId>
                    <version>${versionSonarMavenPlugin}</version>
                </plugin>
                <plugin>
                    <groupId>org.jacoco</groupId>
                    <artifactId>jacoco-maven-plugin</artifactId>
                    <version>${versionJacoco}</version>
                    <configuration>
                        <skip>${skipCoverage}</skip>
                        <destFile>${sonar.jacoco.reportPath}</destFile>
                        <append>true</append>
                    </configuration>
                    <executions>
                        <execution>
                            <id>jacoco-init</id>
                            <goals>
                                <goal>prepare-agent</goal>
                            </goals>
                        </execution>
                        <execution>
                            <id>jacoco-report</id>
                            <phase>verify</phase>
                            <goals>
                                <goal>report</goal>
                            </goals>
                            <configuration>
                                <formats>HTML,XML,CSV</formats>
                                <outputDirectory>my-output-path/target</outputDirectory>
                            </configuration>
                        </execution>
                    </executions>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven</groupId>
                    <artifactId>maven-surefire-plugin</artifactId>
                    <version>${versionSurefirePlugin}</version>
                    <configuration>
                        <argLine>${surefireArgLine} -Xms256m -Xmx2048m</argLine>
                        <includes>
                            <include>**/*Test.java</include>
                        </includes>
                    </configuration>
                </plugin>
            </plugins>
        </pluginManagement>

    </build>

A coverage report is generated, but only containing the tests in testModule/src/main/java. The tests in testModule/src/test/java are not part of the report.

Does anyone know how I can add this folder so the reports cover all the tests?

versionJacoco: 0.8.8 surfire: v3.0.0-M7

I tried using

testSourceDirectory

and

includes

0 Answers0