File tree Expand file tree Collapse file tree 1 file changed +9
-1
lines changed
Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -151,7 +151,15 @@ project.afterEvaluate {
151151 def testJvm = gradle. startParameter. projectProperties[" testJvm" ]
152152 def javaTestLauncher = null as Provider<JavaLauncher >
153153 if (testJvm == " stable" ) {
154- testJvm = " 24"
154+ def javaHomeVersions = System . getenv(). findAll { it. key =~ / ^JAVA_[0-9]+_HOME$/ }
155+ if (javaHomeVersions. isEmpty()) {
156+ throw new GradleException (" No JAVA_X_HOME environment variables found." )
157+ }
158+ def latestVersion = javaHomeVersions. keySet(). collect { key ->
159+ def matcher = key =~ / JAVA_([0-9]+)_HOME/
160+ matcher. group(1 ) as Integer
161+ }. max()
162+ testJvm = latestVersion. toString()
155163 }
156164 if (testJvm) {
157165 def matcher = testJvm =~ / ([a-zA-Z]*)([0-9]+)/
You can’t perform that action at this time.
0 commit comments