Matt-pow
Matt-pow

Reputation: 986

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

Upvotes: 8

Views: 22060

Answers (3)

ndf14685
ndf14685

Reputation: 11

In my case, Im working with gradle, and we have subaplications, we are using sonarqube plugin from azure. I have to adapt to find binaries like this way:

sonar.java.binaries=./streamHubAndroidSDK/build/**,./nota/build/**,./app/build/**

But later I found that its better to define like this:

sonar.java.binaries=**/build/**

I can find this first building Android-Gradle project locally, and looking for all .class generated with bash:

find . -path '*/build/*.class' | xargs | tr ' ' ','

Upvotes: 1

manuna
manuna

Reputation: 861

We also experienced a similar issue on our project (Maven multimodule), and for us the following configuration made things work:

sonar.java.binaries=.
sonar.java.source=8
sonar.sources=.

PS Java source is just for reference, it should not matter to fix the issue.

Upvotes: 6

Ankit Pandoh
Ankit Pandoh

Reputation: 577

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

Upvotes: 8

Related Questions