Pallavi Singh
Pallavi Singh

Reputation: 75

Getting Error on Sonarqube 3.9.0 when I run remotely Local is working fine

When I run sonarqube on server I am always getting below error

Failed to execute goal org.sonarsource.scanner.maven:sonar-maven-plugin:3.9.0.2155:sonar (default-cli) on project <Project name >: Your project contains .java files, please provide compiled classes with sonar.java.binaries property, or exclude them from the analysis with sonar.exclusions property

When I run Sonarqube on my local machine, it is working fine. I am not sure where I have to go and make changes.

I do some googled and find below url(How to correctly configure the property "sonar.java.binaries"?) and mentioned I have to set the property sonar.java.binaries=bin I am not sure where this property file. How I can set on server. Could you please some one help.

I am using Java 11, Sonarqube version 8.9.0 maven version 3.9.0

Also, I found url(https://docs.sonarqube.org/latest/analysis/languages/java/). It mentioned do some changes admin side If I made these changes it will reflect globally. Not project specific. Please help me

Upvotes: 1

Views: 1686

Answers (2)

Dolphin
Dolphin

Reputation: 39055

I am facing the same issue, seems the sonar will need the .class file when scanning. Then I using this command to execute the scan:

mvn clean compile sonar:sonar

this may save your time without other unnessary steps.

Upvotes: 0

seenukarthi
seenukarthi

Reputation: 8682

When you do a sonar analysis using maven you don't need to configure manually.

The error (Your project contains .java files, please provide compiled classes with sonar.java.binaries property, or exclude them from the analysis with sonar.exclusions property) you are experiencing because sonar maven plugin expects the compiled classes in your target\classes folder and the class files are missing. This is due to executing the sonar analysis before the java files are compiled.

To solve this first execute mvn package and then execute maven sonar analysis.

Upvotes: 3

Related Questions