Skip to content

Commit 48e4202

Browse files
committed
Default to minimum required Java version for Groovy 6
Groovy 6 requires Java 17+. Following the same pattern introduced for Groovy 5, build.gradle silently defaults to Java 17 when none was specified. An explicit but incompatible javaVersion still fails loudly. allVariants and allVariants.bat now include 6.0 in the loop, so e.g. `allVariants -DjavaVersion=21` works correctly for all variants.
1 parent d046002 commit 48e4202

3 files changed

Lines changed: 6 additions & 3 deletions

File tree

allVariants

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
#!/bin/sh
2-
for var in 2.5 3.0 4.0 5.0; do
2+
for var in 2.5 3.0 4.0 5.0 6.0; do
33
./gradlew -Dvariant="$var" "$@"
44
done

allVariants.bat

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
@echo off
2-
for %%v in (2.5 3.0 4.0 5.0) do (
2+
for %%v in (2.5 3.0 4.0 5.0 6.0) do (
33
gradlew.bat -Dvariant=%%v %*
44
)

build.gradle

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,10 @@ ext {
5959
minGroovyVersion = "6.0.0"
6060
maxGroovyVersion = "6.9.99"
6161
if (javaVersion < 17) {
62-
throw new InvalidUserDataException("Groovy $variant is not compatible with Java $javaVersion")
62+
if (System.getProperty("javaVersion") != null) {
63+
throw new InvalidUserDataException("Groovy $variant is not compatible with Java $javaVersion")
64+
}
65+
javaVersion = 17
6366
}
6467
} else {
6568
throw new InvalidUserDataException("Unknown variant: $variant. Choose one of: $variants")

0 commit comments

Comments
 (0)