Azure DevOps: Running SonarQube with Java 8

Running SonarQube 9.4 with Azure DevOps project, trying to analyze a gradle (Android) project on MS hosted agent (mac-latest)

I am getting a

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':sonarqube'.
> org/sonar/batch/bootstrapper/EnvironmentInformation has been compiled by a more recent version of the Java Runtime (class file version 55.0), this version of the Java Runtime only recognizes class file versions up to 52.0

I saw the documentation regarding Project specific SDK and tried to apply this, but unsuccessfully.

The setup:
Azure Pipeline:

  1. Sonar Prepare with extra option “$(JAVA_HOME_8_X64)” which should point to the JAVA 8 installation of MS hosted agents from what I found.
  2. Gradle build with enabled option “Run SonarQube or SonarCloud Analysis”
  3. Sonar Publish step

Failing on gradle build due to above error. Shouldn’t the option fix this issue? I tried without it before but adding it didn’t make any difference.

How do I run this successfully?

Hey there.

Take a look at this post:

Ah, I see. Here I can’t use the regular sonarqube extensions DevOps step, but need to run a separate gradle step, right? Does this require to configure sonarqube in the projects gradle files? So far I always only used the DevOps extensions steps