Running SonarScanner For Gradle on Java 7 project

We’re running SonarQube 8.1 and the other teams have had no problem with our implementation. I’m working on getting SonarScanner For Gradle 2.8 integrated into our Java projects and have started with a Java 7 project.

I use SDKMAN to manage Java versions, and as this project requires Java 7, the current JAVA_HOME path is set to Java 7.

When I run build.gradle with the projectKey, host.url, and login parameters set with values provided by the web interface setup process I see the following error:

FAILURE: Build failed with an exception.
* What went wrong:
java.lang.UnsupportedClassVersionError: org/sonarqube/gradle/SonarQubePlugin : Unsupported major.minor version 52.0
> org/sonarqube/gradle/SonarQubePlugin : Unsupported major.minor version 52.0
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
Total time: 1.02 secs

I’ve been looking for a parameter that tells SonarScanner the path to Java 8 but I haven’t found that, I’m assuming this exists and I should be able to add that to the build.gradle or gradle.properties file.

Has anyone found a solution for this?

Thanks!
Lee