This seems to work, although I would hope there’s ...
# gradle
m
This seems to work, although I would hope there’s a better solution:
Copy code
import org.gradle.api.tasks.compile.JavaCompile

// apply java plugin here

(getTasksByName("compileJava", false).first() as JavaCompile).apply {
    sourceCompatibility = JavaVersion.VERSION_1_7.toString()
    targetCompatibility = JavaVersion.VERSION_1_7.toString()
}

(getTasksByName("compileTestJava", false).first() as JavaCompile).apply {
    sourceCompatibility = JavaVersion.VERSION_1_8.toString()
    targetCompatibility = JavaVersion.VERSION_1_8.toString()
}