To people ending up here when searching for the Gradle equivalent of the Maven property maven.compiler.source
(or 1.8
):
In build.gradle you can achieve this with
apply plugin: 'java'
sourceCompatibility = 1.8
targetCompatibility = 1.8
See the Gradle documentation on this.