Hi,
I scan a multi-module Maven project with sonar-scanner-cli. JaCoCo coverage imports without trouble:
sonar.coverage.jacoco.xmlReportPaths=coverage.xml,**/target/site/jacoco/jacoco.xml
Surefire reports do not, even when I point at directories instead of files:
sonar.junit.reportPaths=**/target/surefire-reports,**/target/failsafe-reports
Log output:
INFO parsing [.../**/target/surefire-reports, .../**/target/failsafe-reports]
ERROR Reports path not found or is not a directory: .../**/target/surefire-reports
The scanner treats ** as a literal path. Same if you add TEST-*.xml on the end.
The docs say wildcards only apply when a property mentions them. JaCoCo coverage does. sonar.junit.reportPaths does not. For a reactor with several modules, that means maintaining a comma-separated list of every target/surefire-reports and target/failsafe-reports path, or generating that list in CI before each scan. It works, but it drifts when modules get added or renamed.
Proposal: support ?, *, and ** in sonar.junit.reportPaths, expand them to directories, then parse TEST-*.xml / TESTS-*.xml inside each directory the way SurefireSensor already does. Looks like the right place is SurefireUtils in the java-surefire module.
I found several threads where people tried globs and got the same error:
- How do I show the unit test reports in SonarQube?
- JUnit test reports not imported
- Number of unit tests is zero
- SonarQube can’t find my junit xml files
I can open a PR on sonar-java if this seems reasonable.
Thanks