Search This Blog

Powered by Blogger.

Pages

Browsing "Older Posts"

org.sonar.java.AnalysisException: Your project contains .java files

By TY → Monday, May 17, 2021

When we are using Sonarqube to scan non-java projects like python and go, we will encounter the following error:


org.sonar.java.AnalysisException: Your project contains .java files, please provide compiled classes with sonar.java.binaries property, or exclude them from the analysis with sonar.exclusions property.


To fix:

Add the following to sonar-project.properties

# to exclude java files
sonar.exclusions=**/*.java 

or set sonar.exclusions in the command line.

sonar-scanner \

  -Dsonar.projectKey=local:myproject \

  -Dsonar.sources=. \

  -Dsonar.host.url=http://localhost:9000 \

  -Dsonar.login=xxxxxx \

  -Dsonar.exclusions=**/*.java