feat(docker): update base images to Java 25, Spring 4, Jackson 3, Gradle 9 and optimize JVM options (Project Lilliput) (#5725)

Co-authored-by: Anthony Stirling <[email protected]>
This commit is contained in:
Balázs Szücs
2026-02-24 20:06:32 +00:00
committed by GitHub
co-authored by Anthony Stirling
parent 24128dd318
commit 1f9b90ad57
112 changed files with 3181 additions and 2102 deletions
+51 -16
View File
@@ -2,7 +2,7 @@ plugins {
id "java"
id "jacoco"
id "io.spring.dependency-management" version "1.1.7"
id "org.springframework.boot" version "3.5.9"
id "org.springframework.boot" version "4.0.3"
id "org.springdoc.openapi-gradle-plugin" version "1.9.0"
id "io.swagger.swaggerhub" version "1.3.2"
id "com.diffplug.spotless" version "8.1.0"
@@ -15,20 +15,31 @@ import com.github.jk1.license.render.*
import groovy.json.JsonOutput
import groovy.json.JsonSlurper
import groovy.xml.XmlSlurper
import org.gradle.api.JavaVersion
import org.gradle.api.tasks.testing.Test
import org.gradle.jvm.toolchain.JavaLanguageVersion
ext {
springBootVersion = "3.5.9"
springBootVersion = "4.0.3"
pdfboxVersion = "3.0.6"
imageioVersion = "3.13.0"
lombokVersion = "1.18.42"
bouncycastleVersion = "1.83"
springSecuritySamlVersion = "6.5.6"
springSecuritySamlVersion = "7.0.2"
openSamlVersion = "4.3.2"
commonmarkVersion = "0.27.0"
googleJavaFormatVersion = "1.28.0"
logback = "1.5.25"
commonmarkVersion = "0.27.1"
googleJavaFormatVersion = "1.34.1"
logback = "1.5.28"
junitPlatformVersion = "1.12.2"
modernJavaVersion = 21
}
java {
sourceCompatibility = JavaVersion.VERSION_21
targetCompatibility = JavaVersion.VERSION_21
toolchain {
languageVersion = JavaLanguageVersion.of(project.findProperty('javaVersion')?.toString() ?: '25')
}
}
ext.isSecurityDisabled = { ->
@@ -70,7 +81,6 @@ allprojects {
version = '2.5.3'
configurations.configureEach {
exclude group: 'commons-logging', module: 'commons-logging'
exclude group: "org.springframework.boot", module: "spring-boot-starter-tomcat"
}
}
@@ -138,8 +148,11 @@ subprojects {
apply plugin: 'jacoco'
java {
// 17 is lowest but we support and recommend 21
sourceCompatibility = JavaVersion.VERSION_17
sourceCompatibility = JavaVersion.VERSION_21
targetCompatibility = JavaVersion.VERSION_21
toolchain {
languageVersion = JavaLanguageVersion.of(25)
}
}
if (project.name != "stirling-pdf") {
@@ -167,12 +180,14 @@ subprojects {
}
configurations.configureEach {
exclude group: 'commons-logging', module: 'commons-logging'
exclude group: 'org.springframework.boot', module: 'spring-boot-starter-tomcat'
// Exclude vulnerable BouncyCastle version used in tableau
exclude group: 'org.bouncycastle', module: 'bcpkix-jdk15on'
exclude group: 'org.bouncycastle', module: 'bcutil-jdk15on'
exclude group: 'org.bouncycastle', module: 'bcmail-jdk15on'
// google-java-format 1.34+ requires Guava 33.x (ImmutableSortedMapFauxverideShim);
// force it here so Spotless's FeatureClassLoader resolves the correct version.
resolutionStrategy.force 'com.google.guava:guava:33.4.8-jre'
}
dependencyManagement {
@@ -191,7 +206,11 @@ subprojects {
compileOnly "org.projectlombok:lombok:$lombokVersion"
annotationProcessor "org.projectlombok:lombok:$lombokVersion"
// Jackson 3 (Spring Boot 4 uses tools.jackson)
implementation 'org.springframework.boot:spring-boot-starter-jackson'
testImplementation 'org.springframework.boot:spring-boot-starter-test'
testImplementation 'org.springframework.boot:spring-boot-starter-webmvc-test'
testRuntimeOnly 'org.mockito:mockito-inline:5.2.0'
testRuntimeOnly "org.junit.platform:junit-platform-launcher"
@@ -201,13 +220,15 @@ subprojects {
tasks.withType(JavaCompile).configureEach {
options.encoding = "UTF-8"
options.release = rootProject.ext.modernJavaVersion
if (!project.hasProperty("noSpotless")) {
dependsOn "spotlessApply"
}
}
tasks.named("compileJava", JavaCompile).configure {
options.compilerArgs.add("-parameters")
// options.compilerArgs.add("-Xlint:deprecation")
// options.compilerArgs.add("-Xlint:unchecked")
}
def jacocoReport = tasks.named("jacocoTestReport")
@@ -387,6 +408,17 @@ subprojects {
finalizedBy("copySwaggerDoc")
doNotTrackState("OpenAPI plugin writes outside build directory")
}
tasks.named("bootRun") {
jvmArgs = [
"-XX:+UseG1GC",
"-XX:MaxGCPauseMillis=200",
"-XX:G1HeapRegionSize=4m",
"-XX:+ExplicitGCInvokesConcurrent",
"-XX:+UseStringDeduplication",
"-XX:+UseCompactObjectHeaders"
]
}
}
}
@@ -533,9 +565,12 @@ tasks.register('compileRestartHelper', JavaCompile) {
source = fileTree(dir: 'scripts', include: 'RestartHelper.java')
classpath = files()
destinationDirectory = file("${buildDir}/restart-helper-classes")
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
destinationDirectory = layout.buildDirectory.dir("restart-helper-classes")
def restartMajorVersion = project.ext.modernJavaVersion
def restartCompatibility = JavaVersion.toVersion(restartMajorVersion.toString())
sourceCompatibility = restartCompatibility
targetCompatibility = restartCompatibility
options.release.set(restartMajorVersion)
}
// Task to create restart-helper.jar
@@ -544,9 +579,9 @@ tasks.register('buildRestartHelper', Jar) {
description = 'Builds the restart-helper.jar'
dependsOn 'compileRestartHelper'
from "${buildDir}/restart-helper-classes"
from layout.buildDirectory.dir("restart-helper-classes")
archiveFileName = 'restart-helper.jar'
destinationDirectory = file("${buildDir}/libs")
destinationDirectory = layout.buildDirectory.dir("libs")
manifest {
attributes 'Main-Class': 'RestartHelper'