Overview
In order to test the Spring Framework against newer versions of the JDK (e.g., early access builds for JDK 14, 15, etc.), we should introduce support in our Gradle build that allows us to select an alternative JDK (JAVA_HOME) to use when executing and/or compiling tests.
Proposal
Introduce system properties that can control whether an alternative Java installation is to be used for the current build.
Investigate options available on the CI server (e.g., existing environment variables that point to JDK installations).
Notes
The Bamboo CI server has JDK 14ea installed in /opt/jdk-14. Moreover, installed JDKs available include /opt/jdk-[7-14].
Related Issues
-
24215
-
23678
-
24453
Comment From: sbrannen
Current work on this issue can be seen in the following feature branch: https://github.com/sbrannen/spring-framework/commits/issues/gh-24474-alternate-jdk-versions
Comment From: sbrannen
Also related to #24215 for proper Groovy support.
Comment From: sbrannen
Update:
Support was added to the build in 8f02e1088d7d12918f9fa594837aa32252e6c55c.
A dedicated build plan for JDK 14 will follow on the CI server.
Comment From: sbrannen
Since the 1st build of the JDK 14 build plan passed on the CI server (https://build.spring.io/browse/SPR-JDK14-1), I am closing this issue.
Comment From: sbrannen
The aforementioned commit adds support for the following two JVM system properties that control the Gradle build for alternative JDKs (i.e., a JDK other than the one used to launch the Gradle process).
-
customJavaHome: absolute path to the alternate JDK installation to use to compile Java code and execute tests. Setting this system property causes Groovy 3.0 to be used instead of 2.5.x. This system property is also used inspring-oxm.gradleto determine whether JiBX is supported. -
customJavaSourceVersion: Java version supplied to the--releasecommand line flag to control the Java source and target compatibility version. Supported versions include 9 or higher. Do not set this system property if Java 8 should be used.
Examples:
./gradlew -DcustomJavaHome=/opt/java/jdk-14 test
./gradlew --no-build-cache -DcustomJavaHome=/opt/java/jdk-14 test
./gradlew -DcustomJavaHome=/opt/java/jdk-14 -DcustomJavaSourceVersion=14 test
Comment From: jhoeller
@sbrannen I'll switch to a single canonical version of Groovy again for Spring Framework 5.2.5 since the recently released Groovy 2.5.10 seems to have good enough JDK 14 support for the time being. See #24719
Comment From: sbrannen
OK. Thanks for the heads-up!