Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Sonarqube invalid value for java binaries

I'm trying to upload my project to a remote sonarqube server.

This is the command I run sonar scanner:

sonar-scanner -Dsonar.projectKey=my-project -Dsonar.host.url=https://xxxx:9000 -Dsonar.login=the-secret-key  -Dsonar.java.binaries=**/target/classes

but it throws the error on java.binaries.

INFO: Configured Java source version (sonar.java.source): 
none
INFO: JavaClasspath initialization
ERROR: Invalid value for sonar.java.binaries
INFO: ------------------------------------------------------ 
INFO: EXECUTION FAILURE
INFO: ------------------------------------------------------ 
INFO: Total time: 20.276s
INFO: Final Memory: 10M/161M
INFO: ------------------------------------------------------ 
------------------
ERROR: Error during SonarQube Scanner execution
No files nor directories matching **/target/classes

I tried different values like ./target, /target/, /target/classes (where the jar is being stored). However, I am encountering this error of not found. (even though the directory exists)

By running sonar:sonar on my IDE and maven sonar:sonar on my terminal would send over the result to sonarqube, but my goal is to include this command in my jet-steps

like image 576
Matt-pow Avatar asked Jun 11 '19 02:06

Matt-pow


People also ask

What is Sonar Java binaries property?

sonar.java.binaries (required) Comma-separated paths to directories containing the compiled bytecode files corresponding to your source files. sonar.java.libraries. Comma-separated paths to files with third-party libraries (JAR or Zip files) used by your project.

Does SonarQube support Java 17?

The SonarQube server require Java version 11 and the SonarQube scanners require Java version 11 or 17. SonarQube is able to analyze any kind of Java source files regardless of the version of Java they comply to.

Does SonarQube work with Java 8?

The only prerequisite for running SonarQube is to have Java (Oracle JRE 8 or OpenJDK 8) installed on your machine. Note: On Mac OS X it is highly recommended to install Oracle JDK 8 instead of the corresponding Oracle JRE since the JRE installation does not fully set up your Java environment properly.

Does SonarQube only analysis Java code?

SonarQube is an open source quality management platform, designed to analyze and measure your code's technical quality. It is used to test code written in the main programming languages such as C/C++, JavaScript, Java, C#, PHP, and Python, and even a combination of several languages simultaneously.


1 Answers

Very old post but may help someone. I had similar issue and below configuration worked for me:

sonar.sources=src/main/java
sonar.java.binaries=target/classes
like image 118
Ankit Pandoh Avatar answered Oct 06 '22 21:10

Ankit Pandoh