From 60349a11b08973691b02388f0bb3ba5d9ba75f48 Mon Sep 17 00:00:00 2001 From: Johnny Miller Date: Wed, 29 Nov 2023 08:58:42 +0800 Subject: [PATCH] refactor: update Spring Boot to 3.2.0 and Kotlin 1.9.21 --- .../actions/gradle-submodule-build/action.yml | 10 +++---- .github/workflows/main.yml | 28 +++++++++---------- .gitignore | 2 +- .../api-gateway-bootstrap/build.gradle.kts | 3 +- .../auth-center-bootstrap/build.gradle.kts | 3 +- build.gradle.kts | 12 ++++---- gradle/libs.versions.toml | 18 ++++++------ gradle/wrapper/gradle-wrapper.properties | 4 ++- maf-mis/maf-mis-bootstrap/build.gradle.kts | 2 +- .../oss-center-bootstrap/build.gradle.kts | 3 +- .../build.gradle.kts | 3 +- 11 files changed, 44 insertions(+), 44 deletions(-) diff --git a/.github/actions/gradle-submodule-build/action.yml b/.github/actions/gradle-submodule-build/action.yml index ac671468..9677c02d 100644 --- a/.github/actions/gradle-submodule-build/action.yml +++ b/.github/actions/gradle-submodule-build/action.yml @@ -3,8 +3,8 @@ name: Gradle Submodule Build description: Gradle build for submodule inputs: - temurinVersion: - description: "Temurin JDK version" + javaVersion: + description: "Java version" required: true submodulePath: description: "The path to the submodule" @@ -22,9 +22,9 @@ runs: - name: Setup Java uses: actions/setup-java@v3 with: - java-version: ${{ inputs.temurinVersion }} - distribution: 'temurin' - cache: 'gradle' + java-version: ${{ inputs.javaVersion }} + distribution: "liberica" + cache: "gradle" - name: Grant Execution Permission for `gradlew` shell: bash run: chmod +x gradlew diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 7bd2a1b2..62002ebd 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -6,17 +6,17 @@ name: Java CI with Gradle on: push: branches: - - 'main' - - 'feature/**' + - "main" + - "feature/**" paths-ignore: - - '**.md' - - '_config.yml' + - "**.md" + - "_config.yml" pull_request: branches: - - 'main' + - "main" env: - TEMURIN_VERSION: '17.0.7+7' + JAVA_VERSION: "21" jobs: build-api-gateway: @@ -26,7 +26,7 @@ jobs: - name: "Gradle Build :: api-gateway" uses: ./.github/actions/gradle-submodule-build with: - temurinVersion: ${{ env.TEMURIN_VERSION }} + temurinVersion: ${{ env.JAVA_VERSION }} submodulePath: api-gateway dockerHubUsername: ${{ secrets.DOCKER_HUB_USERNAME }} dockerHubPassword: ${{ secrets.DOCKER_HUB_PASSWORD }} @@ -37,7 +37,7 @@ jobs: - name: "Gradle Build :: auth-center" uses: ./.github/actions/gradle-submodule-build with: - temurinVersion: ${{ env.TEMURIN_VERSION }} + temurinVersion: ${{ env.JAVA_VERSION }} submodulePath: auth-center dockerHubUsername: ${{ secrets.DOCKER_HUB_USERNAME }} dockerHubPassword: ${{ secrets.DOCKER_HUB_PASSWORD }} @@ -48,7 +48,7 @@ jobs: - name: "Gradle Build :: maf-mis" uses: ./.github/actions/gradle-submodule-build with: - temurinVersion: ${{ env.TEMURIN_VERSION }} + temurinVersion: ${{ env.JAVA_VERSION }} submodulePath: maf-mis dockerHubUsername: ${{ secrets.DOCKER_HUB_USERNAME }} dockerHubPassword: ${{ secrets.DOCKER_HUB_PASSWORD }} @@ -59,7 +59,7 @@ jobs: - name: "Gradle Build :: oss-center" uses: ./.github/actions/gradle-submodule-build with: - temurinVersion: ${{ env.TEMURIN_VERSION }} + temurinVersion: ${{ env.JAVA_VERSION }} submodulePath: oss-center dockerHubUsername: ${{ secrets.DOCKER_HUB_USERNAME }} dockerHubPassword: ${{ secrets.DOCKER_HUB_PASSWORD }} @@ -70,7 +70,7 @@ jobs: - name: "Gradle Build :: spring-boot-admin" uses: ./.github/actions/gradle-submodule-build with: - temurinVersion: ${{ env.TEMURIN_VERSION }} + temurinVersion: ${{ env.JAVA_VERSION }} submodulePath: spring-boot-admin dockerHubUsername: ${{ secrets.DOCKER_HUB_USERNAME }} dockerHubPassword: ${{ secrets.DOCKER_HUB_PASSWORD }} @@ -82,9 +82,9 @@ jobs: - name: Setup Java uses: actions/setup-java@v3 with: - java-version: ${{env.TEMURIN_VERSION}} - distribution: 'temurin' - cache: 'gradle' + java-version: ${{env.JAVA_VERSION}} + distribution: "liberica" + cache: "gradle" - name: Grant Execution Permission for `gradlew` run: chmod +x gradlew - name: Check Dependencies Version with Gradle `com.github.ben-manes.versions` Plugin diff --git a/.gitignore b/.gitignore index 345efb4b..cc0e9218 100644 --- a/.gitignore +++ b/.gitignore @@ -9,6 +9,7 @@ HELP.md nohup.out *.log *.gz +.fastRequest/ ### STS ### .apt_generated @@ -61,4 +62,3 @@ gradle-app.setting # # Work around https://youtrack.jetbrains.com/issue/IDEA-116898 # gradle/wrapper/gradle-wrapper.properties - diff --git a/api-gateway/api-gateway-bootstrap/build.gradle.kts b/api-gateway/api-gateway-bootstrap/build.gradle.kts index d3811482..ed6f589d 100644 --- a/api-gateway/api-gateway-bootstrap/build.gradle.kts +++ b/api-gateway/api-gateway-bootstrap/build.gradle.kts @@ -59,8 +59,7 @@ jib { properties = mapOf("excludeDevtools" to "true") } } - val temurinTag: String by project - from.image = "eclipse-temurin:${temurinTag}" + from.image = "${libs.versions.jreImage.get()}:${libs.versions.jreTag.get()}" val dockerHubRepositoryPrefix: String by project val projectArtifactId: String by project val apiGatewayArtifactId: String by project diff --git a/auth-center/auth-center-bootstrap/build.gradle.kts b/auth-center/auth-center-bootstrap/build.gradle.kts index 56320942..e1af6891 100644 --- a/auth-center/auth-center-bootstrap/build.gradle.kts +++ b/auth-center/auth-center-bootstrap/build.gradle.kts @@ -59,8 +59,7 @@ jib { properties = mapOf("excludeDevtools" to "true") } } - val temurinTag: String by project - from.image = "eclipse-temurin:${temurinTag}" + from.image = "${libs.versions.jreImage.get()}:${libs.versions.jreTag.get()}" val dockerHubRepositoryPrefix: String by project val projectArtifactId: String by project val authCenterArtifactId: String by project diff --git a/build.gradle.kts b/build.gradle.kts index fa44f36c..92c546d2 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -8,7 +8,6 @@ import enforcer.rules.RequireGradleVersion import enforcer.rules.RequireJavaVendor import enforcer.rules.RequireJavaVersion -import org.gradle.api.JavaVersion.VERSION_17 import org.gradle.api.tasks.testing.logging.TestExceptionFormat.FULL import org.gradle.api.tasks.testing.logging.TestLogEvent.* import org.jetbrains.kotlin.gradle.tasks.KotlinCompile @@ -32,8 +31,9 @@ plugins { alias(libs.plugins.project.enforcer) } -java.sourceCompatibility = VERSION_17 -java.targetCompatibility = VERSION_17 +java { + sourceCompatibility = JavaVersion.VERSION_21 +} // Disable building any artifacts for the rootProject tasks.withType { @@ -88,8 +88,8 @@ subprojects { tasks.withType { kotlinOptions { - freeCompilerArgs = listOf("-Xjsr305=strict") - jvmTarget = VERSION_17.majorVersion + freeCompilerArgs += "-Xjsr305=strict" + jvmTarget = "21" } } @@ -201,7 +201,7 @@ enforce { } rule(RequireJavaVersion::class.java) { this.setEnforcerLevel("ERROR") - this.setProperty("version", "[${libs.versions.temurinVersion.get()}]") + this.setProperty("version", "[${libs.versions.javaVersion.get()},)") } } diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index d373151d..738fb8f2 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -2,12 +2,14 @@ [versions] # https://github.com/gradle/gradle/releases/tag/v7.6 -gradle = "8.1.1" -javaVendor = "Eclipse Adoptium" +gradle = "8.4" +javaVendor = "BellSoft" # https://github.com/adoptium/temurin17-binaries/releases/tag/jdk-17.0.5%2B8 -temurinVersion = "17.0.7" -# Don't use alpine or slim version, https://hub.docker.com/_/eclipse-temurin/tags?page=1&name=17.0.7_7-jre -temurinTag = "17.0.7_7-jre" +javaVersion = "21" +# Don't use alpine or slim version, https://hub.docker.com/r/bellsoft/liberica-runtime-container/tags?page=1&name=jre-21 +# docker pull bellsoft/liberica-runtime-container:jre-21-cds-musl +jreImage = "bellsoft/liberica-runtime-container" +jreTag = "jre-21-cds-musl" dockerHubRepositoryPrefix = "docker.io/ijohnnymiller/" sas = "0.4.0" spring-boot-admin = "3.0.4" @@ -26,10 +28,10 @@ shardingsphere = "5.2.1" snakeyaml = "1.33" jjwt = "0.11.5" poi = "5.2.3" -kotlin = "1.8.21" -spring-boot = "3.1.3" +kotlin = "1.9.21" +spring-boot = "3.2.0" spring-cloud = "2022.0.4" -spring-dependency-management = "1.1.0" +spring-dependency-management = "1.1.4" jib = "3.3.2" git-version = "0.15.0" versions = "0.42.0" diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index fae08049..3fa8f862 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,7 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.1.1-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-bin.zip +networkTimeout=10000 +validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/maf-mis/maf-mis-bootstrap/build.gradle.kts b/maf-mis/maf-mis-bootstrap/build.gradle.kts index 0747514f..37c75f29 100644 --- a/maf-mis/maf-mis-bootstrap/build.gradle.kts +++ b/maf-mis/maf-mis-bootstrap/build.gradle.kts @@ -58,7 +58,7 @@ jib { properties = mapOf("excludeDevtools" to "true") } } - from.image = "eclipse-temurin:${libs.versions.temurinTag.get()}" + from.image = "${libs.versions.jreImage.get()}:${libs.versions.jreTag.get()}" val projectArtifactId: String by project val mafMisArtifactId: String by project to.image = "${libs.versions.dockerHubRepositoryPrefix.get()}$projectArtifactId.$mafMisArtifactId" diff --git a/oss-center/oss-center-bootstrap/build.gradle.kts b/oss-center/oss-center-bootstrap/build.gradle.kts index 9966b3b0..0b2ee0ec 100644 --- a/oss-center/oss-center-bootstrap/build.gradle.kts +++ b/oss-center/oss-center-bootstrap/build.gradle.kts @@ -59,8 +59,7 @@ jib { properties = mapOf("excludeDevtools" to "true") } } - val temurinTag: String by project - from.image = "eclipse-temurin:${temurinTag}" + from.image = "${libs.versions.jreImage.get()}:${libs.versions.jreTag.get()}" val dockerHubRepositoryPrefix: String by project val projectArtifactId: String by project val ossCenterArtifactId: String by project diff --git a/spring-boot-admin/spring-boot-admin-bootstrap/build.gradle.kts b/spring-boot-admin/spring-boot-admin-bootstrap/build.gradle.kts index 1db9b14b..66cc18e6 100644 --- a/spring-boot-admin/spring-boot-admin-bootstrap/build.gradle.kts +++ b/spring-boot-admin/spring-boot-admin-bootstrap/build.gradle.kts @@ -61,8 +61,7 @@ jib { properties = mapOf("excludeDevtools" to "true") } } - val temurinTag: String by project - from.image = "eclipse-temurin:${temurinTag}" + from.image = "${libs.versions.jreImage.get()}:${libs.versions.jreTag.get()}" val dockerHubRepositoryPrefix: String by project val projectArtifactId: String by project val springBootAdminArtifactId: String by project