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")
}
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments