How to scan Java files without compiled files using sonar scanner?

I’m using SonarQube 7.9.5 and Sonar Scanner

I’ve a Java project which I want to scan it using Sonar Scanner but without building it so there are no compiled classes.

But when ran below command it fails -

./sonar-scanner-cli- -e -Dsonar.web.javaOpts=-Xmx2G<sonar-server> -Dsonar.login=<login-token> -Dsonar.issuesReport.html.enable=true -Dsonar.issuesReport.console.enable=true -Dsonar.projectBaseDir=<base-directory-path>

Error thrown is - Your project contains .java files, please provide compiled classes with property, or exclude them from the analysis with sonar.exclusions property.

From error I could understand that I should set compiled classes path with property or exclude Java files with sonar.exclusions property

But I want to scan Java files without compiled classes. Can you please suggest if there is any other way to do so?


Your version is past EOL. You should upgrade to either the latest version or the current LTS at your earliest convenience. Your upgrade path is:

7.9.5 → 8.9.5 → 9.2.3 (last step optional)

You may find the Upgrade Guide and the LTS-to-LTS Upgrade Notes helpful. If you have questions about upgrading, feel free to open a new thread for that here.

Regarding your question, no you cannot currently analyze Java without providing the class files.