Skip to content

Commit 4daa26d

Browse files
Integrade gradle toolchain to manage java versions (#985)
* Autodetection of installed toolchains * Autoprovisioning if toolchain/jdk is not found
1 parent c8fb530 commit 4daa26d

File tree

2 files changed

+11
-12
lines changed

2 files changed

+11
-12
lines changed

build.gradle

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,13 @@ subprojects {
5151
if (!skipSonarlint) {
5252
apply plugin: "name.remal.sonarlint"
5353
}
54+
55+
java {
56+
toolchain {
57+
// Nails the Java-Version of every Subproject
58+
languageVersion = JavaLanguageVersion.of(21)
59+
}
60+
}
5461

5562
// sonarlint configuration, not to be confused with sonarqube/sonarcloud.
5663
sonarLint {
@@ -61,17 +68,6 @@ subprojects {
6168
}
6269
}
6370

64-
def compileTasks = {
65-
options.encoding = 'UTF-8'
66-
67-
// Nails the Java-Version of every Subproject
68-
sourceCompatibility = JavaVersion.VERSION_21
69-
targetCompatibility = JavaVersion.VERSION_21
70-
}
71-
72-
compileJava(compileTasks)
73-
compileTestJava(compileTasks)
74-
7571
spotless {
7672
java {
7773
// Excludes build folder since it contains generated java classes.

settings.gradle

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
1+
plugins {
2+
id 'org.gradle.toolchains.foojay-resolver-convention' version '0.7.0'
3+
}
4+
15
rootProject.name = 'TJ-Bot'
26

37
include 'application'
48
include 'database'
59
include 'formatter'
610
include 'utils'
7-

0 commit comments

Comments
 (0)