How to scan Java project folder

Must-share information (formatted with Markdown):

  • which versions are you using (SonarQube, Scanner, Plugin, and any relevant extension)
    SonarQube 9.9, sonar scanner cli 5.0.1

  • how is SonarQube deployed: zip, Docker, Helm
    Running locally.

  • what are you trying to achieve
    Scan java or class files inside a project folder and its sub folders.

  • what have you tried so far to achieve this
    Setup a sonarqube project but no options for java. I has options for maven and gradle but my project is not either of the two so the scanner can’t produce any results.

How can i scan java files that are not in maven or gradle project?? please help.
my project folder has around 3 levels of subfolders from
src
-----folder1 -----folder1.1 ----.java files
-----folder1.2 ----.java files
-----folder2 -----folder2.1 ----.java files

Do not share screenshots of logs – share the text itself (bonus points for being well-formatted)!

Welcome :slight_smile:

when not using Maven nor Gradle, you need to use the Sonar CLI scanner, see

Those properties are mandatory for scanning Java, see

sonar.sources
Just set it to src, means the directory above all of your subfolders.

A directory in the list means that all analyzable files and directories recursively below it are included. The path can be relative (to the sonar.projectBaseDir property) or absolute. Wildcards (*, ** and ?) are not allowed.

sonar.java.binaries
you may use wildcards, i.e. **/*.class

Gilbert

hi Gilbert…

Thank you very much. I’ll try to follow this.