Skip to content

Commit 681743b

Browse files
committed
Make sure build and tests run when using Java 21
1 parent 8449f15 commit 681743b

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

build.gradle.kts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,8 @@ plugins {
66
group = "org.gradlex"
77
version = "1.7"
88

9-
java {
10-
sourceCompatibility = JavaVersion.VERSION_1_8
11-
targetCompatibility = JavaVersion.VERSION_1_8
12-
}
9+
tasks.withType<JavaCompile>().configureEach { options.release = 8 }
10+
tasks.withType<GroovyCompile>().configureEach { options.release = 8 }
1311

1412
dependencies {
1513
testImplementation("org.spockframework:spock-core:2.1-groovy-3.0")

src/test/groovy/org/gradlex/javamodule/testing/test/fixture/GradleBuild.groovy

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ class GradleBuild {
5959
tasks.test {
6060
testLogging.showStandardStreams = true
6161
}
62+
tasks.withType<JavaCompile>().configureEach { options.release.set(11) }
6263
"""
6364
file("app/src/main/java/org/example/app/Main.java") << '''
6465
package org.example.app;
@@ -91,6 +92,7 @@ class GradleBuild {
9192
id("java-library")
9293
}
9394
group = "org.example"
95+
tasks.withType<JavaCompile>().configureEach { options.release.set(11) }
9496
'''
9597
}
9698

0 commit comments

Comments
 (0)