Wildcard support for sonar.junit.reportPaths (Surefire, multi-module Maven)

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:

I can open a PR on sonar-java if this seems reasonable.

Thanks

Hey @rubenlr, welcome to the Community! Is there any reason why you’re using SonarScanner CLI instead of Scanner for Maven? Our Scanner for Maven usually takes care of setting this property automatically, and this is what we strongly recommend for Maven projects. Your use case is generally discouraged, so I’m not sure if this feature request makes sense for us. But please do let us know if there’s any specific reason!