File tree Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -155,11 +155,17 @@ project.afterEvaluate {
155
155
if (javaHomeVersions. isEmpty()) {
156
156
throw new GradleException (" No JAVA_X_HOME environment variables found." )
157
157
}
158
- def latestVersion = javaHomeVersions. keySet(). collect { key ->
158
+ def javaVersions = javaHomeVersions. keySet(). collect { key ->
159
159
def matcher = key =~ / JAVA_([0-9]+)_HOME/
160
+ if (! matcher. matches()) {
161
+ return null
162
+ }
160
163
matcher. group(1 ) as Integer
161
- }. max()
162
- testJvm = latestVersion. toString()
164
+ }. findAll { it != null }
165
+ if (javaVersions. isEmpty()) {
166
+ throw new GradleException (" No Java versions found from JAVA_X_HOME environment variables." )
167
+ }
168
+ testJvm = javaVersions. max(). toString()
163
169
}
164
170
if (testJvm) {
165
171
def matcher = testJvm =~ / ([a-zA-Z]*)([0-9]+)/
You can’t perform that action at this time.
0 commit comments