How to exclude java file when using sonar scanner

Facing issue

Error during SonarScanner execution
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.

Here is my sonarscanner.properties file


sonar.projectKey=xxx-xxx
sonar.projectName=xxx xxx
sonar.projectVersion=1.0
sonar.sources=lib,pubspec.yaml
sonar.exclusions=**/*.java
sonar.sourceEncoding=UTF-8
sonar.dart.analyzer.options.override=true

Hi,

I would have expected that configuration to work. I suppose it’s a question of when exclusions kick in.

So instead of the exclusion, try this

sonar.java.file.suffixes=.foo

 
Ann

should i have to write?
sonar.java.file.suffixes=.java

Hi,

No, not at all. That’s the default. But if you want to stop analyzing .java files, then changing the Java file suffix to something else should make them not recognized by analysis.

 
HTH,
Ann