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
CodePudding user response:
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.