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:
ERROR: Re-run SonarQube Scanner using the -X switch to enable full debug logging.
Env info
sonarqube version: 7.7.0.23042
sonarscanner version
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: sonar.java.binaries=target/classes