I was able to work around this in my setup but I don’t like it as it is ugly as hell…
The basic steps are :
- Produce the Generic Test Execution Reports with absolute file names
- In the root pom.xml, the one used to launch the SonarQube analysis, add a Maven property called sonar.testExecutionReportPaths
- In the sonar.testExecutionReportPaths, enter the paths to each individual Generic Test Execution Reports files, separated by a comma.These paths can be relative to the root pom.xml. For example,
<sonar.testExecutionReportPaths> moduleA/target/generic-test-report.xml,moduleB/target/generic-test-report.xml</sonar.testExecutionReportPaths>
As I was saying, it is ugly as hell because :
- You have to change the way the Generic Test Execution Reports are generated to use absolute file names, and this is not always possible if you rely on a 3rd party plugin for example
- You have to manually list all your modules in the property instead of relying on Maven information. This is error prone in case a new module is added for example, it’s easy to add it in Maven
<modules>section and forget to update the property. - You have to introduce this property in the root pom.xml file. My personal style is to keep this file as clean as possible and use a dedicated pom.xml for plugins configuration