Skip to content

Commit b693912

Browse files
committed
Migrate to JAVA 21
1 parent 8571e78 commit b693912

File tree

21 files changed

+67
-50
lines changed

21 files changed

+67
-50
lines changed

ballerina/Ballerina.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,5 @@ license = ["Apache-2.0"]
77
keywords = ["cloud", "kubernetes", "docker", "k8s", "c2c"]
88
distribution = "2201.8.0"
99

10-
[platform.java17]
10+
[platform.java21]
1111
graalvmCompatible = true

ballerina/Dependencies.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
[ballerina]
77
dependencies-toml-version = "2"
8-
distribution-version = "2201.11.0-20241111-172200-095db58f"
8+
distribution-version = "2201.11.0-20241117-133400-a3054b77"
99

1010
[[package]]
1111
org = "ballerina"

build-config/resources/Ballerina.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,5 @@ license = ["Apache-2.0"]
77
keywords = ["cloud", "kubernetes", "docker", "k8s", "c2c"]
88
distribution = "2201.8.0"
99

10-
[platform.java17]
10+
[platform.java21]
1111
graalvmCompatible = true

build.gradle

+5-4
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@
1616
*/
1717

1818
plugins {
19-
id "com.github.spotbugs" version "5.0.14"
20-
id "com.github.johnrengelman.shadow" version "8.1.1"
21-
id "de.undercouch.download" version "5.4.0"
22-
id "net.researchgate.release" version "2.8.0"
19+
id "com.github.spotbugs-base" version "${spotbugsPluginVersion}"
20+
id "com.github.johnrengelman.shadow" version "${shadowJarPluginVersion}"
21+
id "de.undercouch.download" version "${downloadPluginVersion}"
22+
id "net.researchgate.release" version "${releasePluginVersion}"
2323
id 'maven-publish'
2424
}
2525

@@ -114,6 +114,7 @@ subprojects {
114114
ballerinaStdLibs "io.ballerina.stdlib:http-ballerina:${stdlibHttpVersion}"
115115
ballerinaStdLibs "io.ballerina.stdlib:observe-ballerina:${observeVersion}"
116116
ballerinaStdLibs "io.ballerina:observe-ballerina:${observeInternalVersion}"
117+
ballerinaStdLibs "io.ballerina.lib:data.jsondata-ballerina:${stdlibDataJsonDataVersion}"
117118
}
118119
}
119120

cloud-tooling/spotbugs-exclude.xml

+4
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,8 @@
1919
<Match>
2020
<Bug pattern="EI_EXPOSE_REP, EI_EXPOSE_REP2, MS_EXPOSE_REP, MC_OVERRIDABLE_METHOD_CALL_IN_CONSTRUCTOR" />
2121
</Match>
22+
<Match>
23+
<Class name="io.ballerina.c2c.tooling.completion.CloudTomlCompletionContext"/>
24+
<Bug pattern="CT_CONSTRUCTOR_THROW"/>
25+
</Match>
2226
</FindBugsFilter>

compiler-plugin-tests/src/test/java/io/ballerina/c2c/test/samples/NativeBaseTest.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ public void validateCustomBaseImage() throws IOException, InterruptedException,
5252
String content = Files.readString(dockerFile.toPath(), StandardCharsets.UTF_8);
5353
Assert.assertTrue(dockerFile.exists());
5454
Assert.assertTrue(content.contains("FROM alpine"));
55-
Assert.assertTrue(content.contains("FROM ghcr.io/graalvm/native-image-community:17-ol8 as build"));
55+
Assert.assertTrue(content.contains("FROM ghcr.io/graalvm/native-image-community:21-ol9 as build"));
5656
KubernetesUtils.deleteDirectory(DOCKER_TARGET_PATH);
5757
}
5858
}

compiler-plugin-tests/src/test/java/io/ballerina/c2c/test/samples/NativeBuilderConfigTest.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ public void validateDockerBuildOption() throws IOException, InterruptedException
5252
Assert.assertTrue(dockerFile.exists());
5353
Assert.assertTrue(content.contains("RUN native-image -jar custom_builder.jar -H:Name=custom_builder " +
5454
"--no-fallback --static --libc=musl"));
55-
Assert.assertTrue(content.contains("FROM ghcr.io/graalvm/native-image-community:17-muslib-ol8 as build"));
55+
Assert.assertTrue(content.contains("FROM ghcr.io/graalvm/native-image-community:21-muslib-ol9 as build"));
5656
Assert.assertTrue(content.contains("FROM gcr.io/distroless/base"));
5757
KubernetesUtils.deleteDirectory(DOCKER_TARGET_PATH);
5858
}
@@ -65,7 +65,7 @@ public void validateK8sBuildOption() throws IOException, InterruptedException, K
6565
Assert.assertTrue(dockerFile.exists());
6666
Assert.assertTrue(content.contains("RUN native-image -jar custom_builder.jar -H:Name=custom_builder " +
6767
"--no-fallback --static --libc=musl"));
68-
Assert.assertTrue(content.contains("FROM ghcr.io/graalvm/native-image-community:17-muslib-ol8 as build"));
68+
Assert.assertTrue(content.contains("FROM ghcr.io/graalvm/native-image-community:21-muslib-ol9 as build"));
6969
Assert.assertTrue(content.contains("FROM gcr.io/distroless/base"));
7070
KubernetesUtils.deleteDirectory(DOCKER_TARGET_PATH);
7171
}

compiler-plugin-tests/src/test/java/io/ballerina/c2c/test/samples/NativeJobTest.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ public void validateDockerfile() throws IOException {
7171
String content = Files.readString(dockerFile.toPath(), StandardCharsets.UTF_8);
7272
Assert.assertTrue(content.contains("RUN native-image -jar hello.jar -H:Name=hello --no-fallback " +
7373
"-H:+StaticExecutableWithDynamicLibC"));
74-
Assert.assertTrue(content.contains("FROM ghcr.io/graalvm/native-image-community:17-ol8 as build"));
74+
Assert.assertTrue(content.contains("FROM ghcr.io/graalvm/native-image-community:21-ol9 as build"));
7575
Assert.assertTrue(content.contains("FROM gcr.io/distroless/base"));
7676
}
7777

compiler-plugin-tests/src/test/java/io/ballerina/c2c/test/samples/NativeTest.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ public void validateDockerfile() throws IOException {
126126
String content = Files.readString(dockerFile.toPath(), StandardCharsets.UTF_8);
127127
Assert.assertTrue(content.contains("RUN native-image -jar hello.jar -H:Name=hello --no-fallback " +
128128
"-H:+StaticExecutableWithDynamicLibC"));
129-
Assert.assertTrue(content.contains("FROM ghcr.io/graalvm/native-image-community:17-ol8 as build"));
129+
Assert.assertTrue(content.contains("FROM ghcr.io/graalvm/native-image-community:21-ol9 as build"));
130130
Assert.assertTrue(content.contains("FROM gcr.io/distroless/base"));
131131
}
132132

compiler-plugin-tests/src/test/java/io/ballerina/c2c/test/utils/TestUtil.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ public static void generateCaches(Path sourcePath, Path jBalToolsPath) {
9292
defaultBuilder.addCompilationCacheFactory(new FileSystemCache.FileSystemCacheFactory(repo.resolve("cache")));
9393
Project project = BuildProject.load(defaultBuilder, sourcePath);
9494
PackageCompilation packageCompilation = project.currentPackage().getCompilation();
95-
JBallerinaBackend.from(packageCompilation, JvmTarget.JAVA_17);
95+
JBallerinaBackend.from(packageCompilation, JvmTarget.JAVA_21);
9696
}
9797

9898
/**

compiler-plugin-tests/src/test/resources/command/create-cloud-toml/config/create_cloud_toml_cmd.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
"character": 0
2424
}
2525
},
26-
"newText": "# This file contains most used configurations supported by Ballerina Code to Cloud\n# All the fields are optional. If these fields are not specified, default value will be taken from the compiler.\n# Full Code to Cloud specification can be accessed from https://github.com/ballerina-platform/ballerina-spec/blob/master/c2c/code-to-cloud-spec.md\n# Uncomment Any field below if you want to override the default value.\n\n# Settings related to artifacts generation\n#[settings]\n#buildImage = true # Build the Docker image while building the project\n#thinJar = true # Use the thin jars in the container\n#\n# Properties related to the container image\n#[container.image]\n#name = \"hello\" # Name of the container image\n#repository = \"ballerina\" # Container repository to host the container\n#tag = \"latest\" # Tag of the container\n#base = \"ballerina/jvm-runtime:2.0\" # Base container of the container image\n#\n# Copy the files to the container image\n#[[container.copy.files]]\n#sourceFile = \"./data/data.txt\" # Path to the external file\n#target = \"/home/ballerina/data/data.txt\" # Path of the file within the container\n#\n# External files required for the code\n#[[cloud.config.maps]]\n#file = \"resource/file.txt\" # Path of the external file\n#mount_dir = \"/home/ballerina/resource\" # Directory of the file within the container\n#\n# Environment variables required for the application\n#[[cloud.config.envs]]\n#key_ref = \"FOO\" # Key of the environment variable\n#name = \"foo\" # Name of the env if it is different from the key\n#config_name = \"module-foo\" # Name of the config config map\n#\n# Properties related to the deployment\n#[cloud.deployment]\n#min_memory = \"100Mi\" # Minimum memory allocated to the container\n#max_memory = \"512Mi\" # Maximum memory allocated to the container\n#min_cpu = \"200m\" # Minimum CPU allocated to the container\n#max_cpu = \"500m\" # Maximum CPU allocated to the container\n#\n# Matrices to auto-scale the container\n#[cloud.deployment.autoscaling]\n#min_replicas = 1 # Minimum number of replicas of the container alive at a given time\n#max_replicas = 2 # Maximum number of replicas of the container alive at a given time\n#cpu = 50 # CPU Utilization threshold for spawning a new instance\n#\n# Probe to indicate whether the container is ready to respond to requests. No readiness probe will be generated if not specified\n#[cloud.deployment.probes.readiness]\n#port = 9091 # Port of the readiness probe endpoint\n#path = \"/probes/readyz\" # Endpoint of the readiness probe\n#\n# Probe to indicate whether the container is running. No liveness probe will be generated if not specified\n#[cloud.deployment.probes.liveness]\n#port = 9091 # Port of the liveness probe endpoint\n#path = \"/probes/healthz\" # Endpoint of the liveness probe\n#\n# Volume definitions of the application. No default volumes will be generated if not specified\n#[[cloud.deployment.storage.volumes]]\n#name = \"volume1\" # Name of the volume\n#local_path = \"files\" # Path of the volume\n#size = \"2Gi\" # Maximum size of the volume\n#\n# Properties related to the builder image of the multistage build\n#[graalvm.builder]\n#base = \"ghcr.io/graalvm/native-image-community:17-ol8\" # base image of the builder image\n#buildCmd = \"native-image -jar hello.jar hello\" # RUN statement to build the native image\n#"
26+
"newText": "# This file contains most used configurations supported by Ballerina Code to Cloud\n# All the fields are optional. If these fields are not specified, default value will be taken from the compiler.\n# Full Code to Cloud specification can be accessed from https://github.com/ballerina-platform/ballerina-spec/blob/master/c2c/code-to-cloud-spec.md\n# Uncomment Any field below if you want to override the default value.\n\n# Settings related to artifacts generation\n#[settings]\n#buildImage = true # Build the Docker image while building the project\n#thinJar = true # Use the thin jars in the container\n#\n# Properties related to the container image\n#[container.image]\n#name = \"hello\" # Name of the container image\n#repository = \"ballerina\" # Container repository to host the container\n#tag = \"latest\" # Tag of the container\n#base = \"ballerina/jvm-runtime:2.0\" # Base container of the container image\n#\n# Copy the files to the container image\n#[[container.copy.files]]\n#sourceFile = \"./data/data.txt\" # Path to the external file\n#target = \"/home/ballerina/data/data.txt\" # Path of the file within the container\n#\n# External files required for the code\n#[[cloud.config.maps]]\n#file = \"resource/file.txt\" # Path of the external file\n#mount_dir = \"/home/ballerina/resource\" # Directory of the file within the container\n#\n# Environment variables required for the application\n#[[cloud.config.envs]]\n#key_ref = \"FOO\" # Key of the environment variable\n#name = \"foo\" # Name of the env if it is different from the key\n#config_name = \"module-foo\" # Name of the config config map\n#\n# Properties related to the deployment\n#[cloud.deployment]\n#min_memory = \"100Mi\" # Minimum memory allocated to the container\n#max_memory = \"512Mi\" # Maximum memory allocated to the container\n#min_cpu = \"200m\" # Minimum CPU allocated to the container\n#max_cpu = \"500m\" # Maximum CPU allocated to the container\n#\n# Matrices to auto-scale the container\n#[cloud.deployment.autoscaling]\n#min_replicas = 1 # Minimum number of replicas of the container alive at a given time\n#max_replicas = 2 # Maximum number of replicas of the container alive at a given time\n#cpu = 50 # CPU Utilization threshold for spawning a new instance\n#\n# Probe to indicate whether the container is ready to respond to requests. No readiness probe will be generated if not specified\n#[cloud.deployment.probes.readiness]\n#port = 9091 # Port of the readiness probe endpoint\n#path = \"/probes/readyz\" # Endpoint of the readiness probe\n#\n# Probe to indicate whether the container is running. No liveness probe will be generated if not specified\n#[cloud.deployment.probes.liveness]\n#port = 9091 # Port of the liveness probe endpoint\n#path = \"/probes/healthz\" # Endpoint of the liveness probe\n#\n# Volume definitions of the application. No default volumes will be generated if not specified\n#[[cloud.deployment.storage.volumes]]\n#name = \"volume1\" # Name of the volume\n#local_path = \"files\" # Path of the volume\n#size = \"2Gi\" # Maximum size of the volume\n#\n# Properties related to the builder image of the multistage build\n#[graalvm.builder]\n#base = \"ghcr.io/graalvm/native-image-community:21-ol9\" # base image of the builder image\n#buildCmd = \"native-image -jar hello.jar hello\" # RUN statement to build the native image\n#"
2727
}
2828
]
2929
}

compiler-plugin-tests/src/test/resources/completion/ballerina/config/config1.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@
66
"source": "source/project1/Ballerina.toml",
77
"items": [
88
{
9-
"label": "platform.java17.dependency",
9+
"label": "platform.java21.dependency",
1010
"kind": "Snippet",
1111
"detail": "Table Array",
1212
"sortText": "C",
13-
"insertText": "[[platform.java17.dependency]]"
13+
"insertText": "[[platform.java21.dependency]]"
1414
},
1515
{
1616
"label": "package",

compiler-plugin-tests/src/test/resources/completion/ballerina/source/Ballerina.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
[build-options]
44
observabilityIncluded = true
55

6-
[[platform.java17.dependency]]
6+
[[platform.java21.dependency]]
77
path = "/usr/libs/"
88

99

compiler-plugin/spotbugs-exclude.xml

+4
Original file line numberDiff line numberDiff line change
@@ -55,4 +55,8 @@
5555
<Match>
5656
<Bug pattern="EI_EXPOSE_REP, EI_EXPOSE_REP2, MS_EXPOSE_REP" />
5757
</Match>
58+
<Match>
59+
<Class name="io.ballerina.c2c.utils.DockerImageName"/>
60+
<Bug pattern="CT_CONSTRUCTOR_THROW"/>
61+
</Match>
5862
</FindBugsFilter>

compiler-plugin/src/main/java/io/ballerina/c2c/DockerGenConstants.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ public class DockerGenConstants {
2727
public static final String REGISTRY_SEPARATOR = "/";
2828
public static final String TAG_SEPARATOR = ":";
2929
public static final String JRE_SLIM_BASE = "ballerina/jvm-runtime:3.0";
30-
public static final String NATIVE_BUILDER_IMAGE = "ghcr.io/graalvm/native-image-community:21-ol8";
30+
public static final String NATIVE_BUILDER_IMAGE = "ghcr.io/graalvm/native-image-community:21-ol9";
3131
public static final String NATIVE_RUNTIME_BASE_IMAGE = "gcr.io/distroless/base";
3232
public static final int MAX_BALLERINA_LAYERS = 110;
3333

compiler-plugin/src/main/java/io/ballerina/c2c/tasks/C2CCodeGeneratedTask.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ private void setupForRunningTestsInCloud(CompilerLifecycleEventContext compilerL
145145
Optional<Path> executablePath, Project project, Package currentPackage,
146146
BalCommand balCommand) {
147147
JBallerinaBackend jBallerinaBackend = JBallerinaBackend.from(compilerLifecycleEventContext.compilation(),
148-
JvmTarget.JAVA_17);
148+
JvmTarget.JAVA_21);
149149
dataHolder.getDockerModel().setTest(true);
150150
executablePath.ifPresent(path -> {
151151
Target target;
@@ -331,7 +331,7 @@ private void addTestDependencyJars(Project project, PackageCompilation compilati
331331
Map<String, TestSuite> testSuiteMap,
332332
List<Path> classPaths, List<Path> moduleJarPaths) {
333333
JBallerinaBackend jBallerinaBackend = JBallerinaBackend.from(compilation,
334-
JvmTarget.JAVA_17);
334+
JvmTarget.JAVA_21);
335335
JarResolver jarResolver = jBallerinaBackend.jarResolver();
336336

337337
Collection<JarLibrary> dependencies = jarResolver.getJarFilePathsRequiredForTestExecution(
@@ -378,7 +378,7 @@ private static Path getCopiedJarPath(Path jarFileName) {
378378

379379
private void addDependencyJars(PackageCompilation compilation, String executableFatJar) {
380380
JBallerinaBackend jBallerinaBackend = JBallerinaBackend.from(compilation,
381-
JvmTarget.JAVA_17);
381+
JvmTarget.JAVA_21);
382382
io.ballerina.projects.JarResolver jarResolver = jBallerinaBackend.jarResolver();
383383
// Add dependency jar files to docker model.
384384
dataHolder.getDockerModel().addDependencyJarPaths(

compiler-plugin/src/main/java/io/ballerina/c2c/tasks/ChoreoCodeGenTask.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ public void codeGeneratedInternal(PackageID packageId, Path executableJarFile, S
119119
}
120120

121121
private void addDependencyJars(PackageCompilation compilation, String executableFatJar) {
122-
JBallerinaBackend jBallerinaBackend = JBallerinaBackend.from(compilation, JvmTarget.JAVA_17);
122+
JBallerinaBackend jBallerinaBackend = JBallerinaBackend.from(compilation, JvmTarget.JAVA_21);
123123
io.ballerina.projects.JarResolver jarResolver = jBallerinaBackend.jarResolver();
124124

125125
// Add dependency jar files to docker model.

compiler-plugin/src/main/resources/c2c-schema.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -514,7 +514,7 @@
514514
"description": "base image of the builder image",
515515
"type": "string",
516516
"pattern": "^(?!\\s*$).+",
517-
"default": "ghcr.io/graalvm/native-image-community:17-ol8",
517+
"default": "ghcr.io/graalvm/native-image-community:21-ol9",
518518
"message": {
519519
"pattern": "`base` should not be empty"
520520
}

examples/graalvm-custom-builder/Cloud.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,5 @@ tag = "1.0.0"
77
buildImage = false
88

99
[graalvm.builder]
10-
base = "ghcr.io/graalvm/native-image-community:17-muslib-ol8"
10+
base = "ghcr.io/graalvm/native-image-community:21-muslib-ol9"
1111
buildCmd = "native-image -jar custom_builder.jar -H:Name=custom_builder --no-fallback --static --libc=musl"

gradle.properties

+28-23
Original file line numberDiff line numberDiff line change
@@ -3,27 +3,32 @@ org.gradle.jvmargs='-Dfile.encoding=UTF-8'
33
group=io.ballerina
44
version=3.1.1-SNAPSHOT
55
systemProp.org.gradle.internal.publish.checksums.insecure=true
6-
ballerinaLangVersion=2201.11.0-20241111-172200-095db58f
7-
stdlibConstraintVersion=1.5.0
8-
stdlibIoVersion=1.6.1
9-
stdlibLogVersion=2.10.0
10-
stdlibHttpVersion=2.12.0
11-
stdlibAuthVersion=2.12.0
12-
stdlibFileVersion=1.10.0
13-
stdlibCacheVersion=3.8.0
14-
stdlibCryptoVersion=2.7.2
15-
stdlibTimeVersion=2.4.0
16-
stdlibMimeVersion=2.10.0
17-
stdlibOsVersion=1.8.0
18-
stdlibTaskVersion=2.5.0
19-
stdlibJwtVersion=2.13.0
20-
stdlibGrpcVersion=1.12.0
21-
stdlibOAuth2Version=2.12.0
22-
stdlibUuidVersion=1.8.0
23-
stdlibGraphqlVersion=1.14.0
24-
stdlibUrlVersion=2.4.0
25-
stdlibWebsubVersion=2.12.0
26-
stdlibWebsubhubVersion=1.12.0
27-
observeVersion=1.3.0
28-
observeInternalVersion=1.3.0
6+
spotbugsPluginVersion=6.0.18
7+
shadowJarPluginVersion=8.1.1
8+
downloadPluginVersion=5.4.0
9+
releasePluginVersion=2.8.0
10+
ballerinaLangVersion=2201.11.0-20241117-133400-a3054b77
11+
stdlibConstraintVersion=1.6.0-20241113-090900-d276ad5
12+
stdlibIoVersion=1.6.2-20241112-233100-995cf5f
13+
stdlibLogVersion=2.10.1-20241113-120000-4577868
14+
stdlibHttpVersion=2.13.0-20241114-182900-7e9f66a
15+
stdlibAuthVersion=2.12.1-20241113-162300-ded40eb
16+
stdlibFileVersion=1.10.1-20241113-151700-e1a2e38
17+
stdlibCacheVersion=3.8.1-20241113-125700-b75a1bf
18+
stdlibCryptoVersion=2.7.3-20241113-081400-d015a39
19+
stdlibTimeVersion=2.6.0-20241113-073800-201b904
20+
stdlibMimeVersion=2.10.2-20241113-154200-d953747
21+
stdlibOsVersion=1.8.1-20241113-122000-cca973b
22+
stdlibTaskVersion=2.5.1-20241113-123500-f905281
23+
stdlibJwtVersion=2.13.1-20241113-162400-b59ccfa
24+
stdlibGrpcVersion=1.13.0-20241114-195700-5188f60
25+
stdlibOAuth2Version=2.12.1-20241113-162400-4c6ddfe
26+
stdlibDataJsonDataVersion=0.3.0-20241114-143900-285d739
27+
stdlibUuidVersion=1.8.1-20241113-154400-443c67b
28+
stdlibGraphqlVersion=1.15.0-20241117-164000-4d95b39
29+
stdlibUrlVersion=2.4.1-20241113-073900-335ff51
30+
stdlibWebsubVersion=2.13.0-20241114-233100-73205d6
31+
stdlibWebsubhubVersion=1.13.0-20241116-124900-2bb76a4
32+
observeVersion=1.4.0-20241113-092000-b83ae74
33+
observeInternalVersion=1.3.1-20241113-101700-265054d
2934
ballerinaGradlePluginVersion=2.0.1

gradle/javaProject.gradle

+6-3
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ tasks.withType(JavaCompile) {
3535
options.encoding = 'UTF-8'
3636
}
3737

38-
sourceCompatibility = JavaVersion.VERSION_17
38+
sourceCompatibility = JavaVersion.VERSION_21
3939

4040
jacoco {
4141
toolVersion = "0.8.10"
@@ -58,8 +58,11 @@ test {
5858

5959
spotbugsMain {
6060
ignoreFailures = true
61-
effort = "max"
62-
reportLevel = "low"
61+
def classLoader = plugins["com.github.spotbugs"].class.classLoader
62+
def SpotBugsConfidence = classLoader.findLoadedClass("com.github.spotbugs.snom.Confidence")
63+
def SpotBugsEffort = classLoader.findLoadedClass("com.github.spotbugs.snom.Effort")
64+
effort = SpotBugsEffort.MAX
65+
reportLevel = SpotBugsConfidence.LOW
6366
reportsDir = file("$project.buildDir/reports/spotbugs")
6467
def excludeFile = file("spotbugs-exclude.xml")
6568
if (excludeFile.exists()) {

0 commit comments

Comments
 (0)