I'm building a Java FX application which uses the Dialog
classes added to Oracle JDK 1.8 in update 40. Therefore, the minimal required Java version is 1.8u40.
I now want to ensure this version requirement in my Gradle build file. Obviously, checking against the major version with
assert org.gradle.api.JavaVersion.current().isJava8Compatible()
does not help in this case as it omits the update number.
How do I specify this contraint in my build file?
Taking into account Opal's suggestion the following splits the version string and checks against the update number.
if (javaVersion.startsWith("1.8.0") && javaVersion.split("_")[1].toInteger() < 40) {
throw new GradleException("Java version 1.8.0_40 or later required, but was $javaVersion")
}
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