Skip to content

Commit 83983d1

Browse files
committed
Add Gradle toolchain configuration
1 parent f9f10ff commit 83983d1

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

gradle/defaults-java.gradle

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,34 @@
1+
ext.vendor = { ->
2+
// By specifying the vendor, we force us (and CI) to
3+
// use that specific JDK version. If it is not locally
4+
// available, Gradle will provision the toolchain, i.e.
5+
// download it.
6+
if (project.hasProperty("javaLanguageVendor")) {
7+
return JvmVendorSpec.matching(project.property('javaLanguageVendor'))
8+
} else {
9+
return JvmVendorSpec.matching("ADOPTIUM")
10+
}
11+
}
12+
13+
ext.languageVersion = { ->
14+
if (project.hasProperty("javaLanguageVersion")) {
15+
return JavaLanguageVersion.of(project.property('javaLanguageVersion'))
16+
} else {
17+
return JavaLanguageVersion.of(11)
18+
}
19+
}
20+
21+
allprojects {
22+
plugins.withType(JavaPlugin) {
23+
java {
24+
toolchain {
25+
vendor = vendor()
26+
languageVersion = languageVersion()
27+
}
28+
}
29+
}
30+
}
31+
132
allprojects {
233
plugins.withType(JavaLibraryPlugin) {
334
sourceCompatibility = JavaVersion.VERSION_11

0 commit comments

Comments
 (0)