Your project contains .java files error

Note that in my SC configuration I have *.java in the exclusions list:

  • ALM used: Bitbucket
  • CI system used: Bitbucket Cloud
  • Languages of the repository: Primarily Typescript
  • Error observed:
ERROR: 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.
	at org.sonar.java.classpath.ClasspathForMain.init(ClasspathForMain.java:75)
	at org.sonar.java.classpath.AbstractClasspath.getElements(AbstractClasspath.java:319)
	at org.sonar.java.SonarComponents.getJavaClasspath(SonarComponents.java:205)
	at org.sonar.java.JavaFrontend.<init>(JavaFrontend.java:97)
  • Steps to reproduce
    My pipeline step:
    - step: &sonar-scan
        name: Sonar Scan
        caches:
          - node
          - sonar
        runs-on:
          - self.hosted
        script:
          - pipe: sonarsource/sonarcloud-scan:1.4.0
            variables:
              SONAR_TOKEN: ${SONAR_TOKEN}
          - pipe: sonarsource/sonarcloud-quality-gate:0.1.6
            variables:
              SONAR_TOKEN: ${SONAR_TOKEN}

Hi,

Welcome to the community!

As detailed in the UI and in the docs ** is needed to match 0 or more directories in the path. Your pattern excludes all .java files in project root. Try instead: **/*.java.

 
HTH,
Ann

Thanks, got past this issue.