Sonar.java.binaries path not interpreting correctly

We have two projects, and code that sets up sonar-scanner.
In the setup code, we default sonar.java.binaries=**/target/classes.
This works correctly in the first project, where we scan from /root/projectA, and our build is in root/projectA/moduleA/target/classes.
In our second project, the build happens in the same directory we scan from, so /root/projectB/target/classes. In this case sonar-scanner errors and says no directory exists at **/target/classes.

From the docs, ** is zero or more paths, does zero not include current dir?

Hey there.

First things first – we really recommend that you use a purpose-built scanner (like the SonarScanner for Maven, Gradle or Ant) which will populate these properties automatically and correctly.

Putting that aside for a moment – I ran a quick test with the basic SonarScanner and at first I thought sonar.java.binaries simply didn’t support wildcards. And, then I moved up a directory and re-ran the analysis (and set sonar.sources)… sonar.java.binaries=**/target/classes worked as expected.

This smells like a bug… Because I think ** is meant to be any directory (recursively), including the one you’re already in. I’ll toss this over to the relevant team to have a look.

And, for the second project, you should be able to just set /target/classes and call it a day for now.