[sonar-scanner error] sonar.java.binaries property

Problem Summary

run sonar-scanner in my project root and get error “ERROR: Please provide compiled classes of your project with sonar.java.binaries property”

Steps to reproduce


get sonarqube run in docker

docker run -d --name sonarqube -p 9000:9000 sonarqube


create a token and get the sonars-canner run options

sonar-scanner \
  -Dsonar.projectKey=go_wallet \
  -Dsonar.sources=. \
  -Dsonar.host.url=http://localhost:9000 \


cd to my golang project at $GOPATH/src/ and run the sonar-scanner with above option, got error

ERROR: Error during SonarQube Scanner execution
ERROR: Please provide compiled classes of your project with sonar.java.binaries property
ERROR: Re-run SonarQube Scanner using the -X switch to enable full debug logging.

Env info

sonarqube version:
sonarscanner version

shiming@pro ➜  wallet git:(master) ✗ sonar-scanner -v
INFO: Scanner configuration file: /Users/shiming/Downloads/sonar-scanner-
INFO: Project root configuration file: NONE
INFO: SonarQube Scanner
INFO: Java 1.8.0_121 Oracle Corporation (64-bit)
INFO: Mac OS X 10.14.1 x86_64


  1. What’s the error talk about? (I am not familiar with java, please explained in plain words )
  2. How can I solve it?


For many languages you only need source code for analysis. For Java you need to feed in both source code and the compiled byte code. I’m guessing you’re not a project owner or contributed. You should consult those folks to find out how to compile the project. Once it’s compiled, you’ll then need to pass the location of the binary files into analysis.

If they use Maven for compile, then you can use SonarQube Scanner for Maven to run analysis and it handle most of the configuration - including the location of the binaries - for you. Ditto Gradle.


Hi, thanks for reply, I want to analysis golang program rather then java, in step3 I have mentioned that. So how can I run sonar scanner to analysis golang project successful? It keeps return error ERROR: Please provide compiled classes of your project with sonar.java.binaries property


It wouldn’t be giving you that message if Java files weren’t found in the project. SonarQube analysis is multi-language and by default every file with a recognized extension is going to be analyzed. If you want to ignore files that end with .java you’ll need to set up an exclusion like **/*.java.


Just to clarify how to use the sonar.java.binaries property. Use the path to the folder containing the class files as the value. Add this property in the sonar-project.properties file. In my case the classes were sitting in target/classes, like so:


Add the following to your sonar properties file when you scanning golang or python projects


org.sonar.java.AnalysisException: Your project contains .java files