org.sonar.java.AnalysisException: Your project contains .java files, please provide compiled classes

Must-share information (formatted with Markdown):

  • which versions are you using (SonarQube, Scanner, Plugin, and any relevant extension)
    • SonarQube Enterprise Edition Version 8.9.6 (build 50800)
  • what are you trying to achieve
    I am trying to configure a sonar scan in gitlab for a directory with .java files.

  • what have you tried so far to achieve this
    I have a configured .gitlab-ci.yml file. I saw in other threads to use sonar.java.binaries instead of sonar.binaries = <property name="sonar.java.binaries" value="target"/> but I’m not using ANT. How would I change this variable since I’m using Gitlab?

What are you using to build your Java files? (Maven, Gradle, etc.)

Hi Colin,

I’m quite new to software development so I just assumed sonarqube would be able to read .java files. It looks like… I’ll have to set up either Maven or Gradle for gitlab ci/cd? Is there any advantage to whichever one I choose?

Thanks!
Tony