How can I configure Gradle to compile test classes for a different Java version than source classes?
I'm writing a project for Java 1.7, and I want to use Java 1.8 in my tests so I can use Lambda Behave. In Maven this is pretty straightforward, but I can't see how to achieve the same result in Gradle.
Of course, immediately after posting the question I stumble across the answer!
apply plugin: "java"
compileJava {
sourceCompatibility = 1.7
}
compileTestJava {
sourceCompatibility = 1.8
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With