From 7efc8803b0a4d7f5a34ccdc76a23bd6a61bf8f9f Mon Sep 17 00:00:00 2001 From: Dima Denysenko Date: Thu, 19 Oct 2023 13:13:48 +0300 Subject: [PATCH] feat: migrate to java 21 --- .drone/pipelines.yml | 56 ++++++++++------------ .github/workflows/check-commit-message.yml | 2 +- README.md | 2 +- api-gateway/pom.xml | 2 +- config-server/pom.xml | 2 +- department-service/pom.xml | 2 +- hystrix-dashboard/pom.xml | 2 +- package.json | 6 +-- pom.xml | 25 +++++++--- service-registry/pom.xml | 2 +- user-profile-service/pom.xml | 2 +- 11 files changed, 56 insertions(+), 47 deletions(-) diff --git a/.drone/pipelines.yml b/.drone/pipelines.yml index f6f5944..a656d92 100644 --- a/.drone/pipelines.yml +++ b/.drone/pipelines.yml @@ -16,14 +16,13 @@ volumes : steps : - name : code-coverage-gate - image : know-how.download/svc-builder:ibm-semeru-runtimes-open-17-jdk-focal + image : know-how.download/svc-builder:openjdk-21-slim-bookworm pull : if-not-exists volumes : - name : m2cache path : /root/.m2 environment : MONGODB_SERVER_URI : mongodb://svc_testing_mongo:svc_testing_mongo@mongo:27017/userprofiledb?authSource=admin - MAVEN_OPTS : --add-opens java.base/java.lang=ALL-UNNAMED DEPLOYER_USERNAME : from_secret : DEPLOYER_USERNAME DEPLOYER_PASSWORD : @@ -41,13 +40,12 @@ steps : - name : static-analysis-gate depends_on : - code-coverage-gate - image : know-how.download/svc-builder:ibm-semeru-runtimes-open-17-jdk-focal + image : know-how.download/svc-builder:openjdk-21-slim-bookworm pull : if-not-exists volumes : - name : m2cache path : /root/.m2 environment : - MAVEN_OPTS : --add-opens java.base/java.lang=ALL-UNNAMED DEPLOYER_USERNAME : from_secret : DEPLOYER_USERNAME DEPLOYER_PASSWORD : @@ -59,7 +57,8 @@ steps : commands : - mvn org.apache.maven.plugins:maven-dependency-plugin:3.5.0:copy-dependencies -Dmdep.prependGroupId=true -Dstyle.color=always -s ../maven-settings.xml -Ddeployer.username=$DEPLOYER_USERNAME -Ddeployer.password=$DEPLOYER_PASSWORD - mvn sonar:sonar '-Dsonar.java.libraries=target/dependency/*.jar' '-Dsonar.java.test.libraries=target/classes,target/dependency/*.jar' -Dsonar.qualitygate.wait=true -Dsonar.qualitygate.timeout=300 -Dsonar.host.url=$SONAR_HOST -Dsonar.login=$SONAR_TOKEN -Dsonar.projectKey=${DRONE_REPO_OWNER}:${DRONE_REPO_NAME} -Dsonar.projectName=${DRONE_REPO_OWNER}:${DRONE_REPO_NAME} -Dstyle.color=always -Dmaven.javadoc.skip=true --batch-mode -s ../maven-settings.xml -Ddeployer.username=$DEPLOYER_USERNAME -Ddeployer.password=$DEPLOYER_PASSWORD - - mvn pmd:check --batch-mode -Dstyle.color=always -s ../maven-settings.xml -Ddeployer.username=$DEPLOYER_USERNAME -Ddeployer.password=$DEPLOYER_PASSWORD + - pmd check -d ./user-profile-service -f text -R https://raw.githubusercontent.com/pmd/pmd/master/pmd-java/src/main/resources/rulesets/java/basic.xml + - pmd check -d ./department-service -f text -R https://raw.githubusercontent.com/pmd/pmd/master/pmd-java/src/main/resources/rulesets/java/basic.xml - mvn com.github.spotbugs:spotbugs-maven-plugin:4.7.3.4:check -s ../maven-settings.xml -Ddeployer.username=$DEPLOYER_USERNAME -Ddeployer.password=$DEPLOYER_PASSWORD -Dspotbugs.xmlOutput=true -Dspotbugs.failOnError=true -Dspotbugs.excludeFilterFile=../spotbugs-exclude.xml -Dspotbugs.includeTests=true -Dstyle.color=always - name : notify-slack-on-failure @@ -111,12 +110,11 @@ volumes : steps : - name : publish-snapshot-jar - image : know-how.download/svc-builder:ibm-semeru-runtimes-open-17-jdk-focal + image : know-how.download/svc-builder:openjdk-21-slim-bookworm volumes : - name : m2cache path : /root/.m2 environment : - MAVEN_OPTS : --add-opens java.base/java.lang=ALL-UNNAMED DEPLOYER_USERNAME : from_secret : DEPLOYER_USERNAME DEPLOYER_PASSWORD : @@ -131,13 +129,12 @@ steps : - "*.*.x" - name : publish-release-jar - image : know-how.download/svc-builder:ibm-semeru-runtimes-open-17-jdk-focal + image : know-how.download/svc-builder:openjdk-21-slim-bookworm pull : if-not-exists volumes : - name : m2cache path : /root/.m2 environment : - MAVEN_OPTS : --add-opens java.base/java.lang=ALL-UNNAMED DEPLOYER_USERNAME : from_secret : DEPLOYER_USERNAME DEPLOYER_PASSWORD : @@ -205,13 +202,12 @@ volumes : steps : - name : package-jar - image : know-how.download/svc-builder:ibm-semeru-runtimes-open-17-jdk-focal + image : know-how.download/svc-builder:openjdk-21-slim-bookworm pull : if-not-exists volumes : - name : m2cache path : /root/.m2 environment : - MAVEN_OPTS : --add-opens java.base/java.lang=ALL-UNNAMED DEPLOYER_USERNAME : from_secret : DEPLOYER_USERNAME DEPLOYER_PASSWORD : @@ -235,7 +231,7 @@ steps : registry : know-how.download force_tag : true build_args : - - BASE_IMAGE=know-how.download/jre:ibm-semeru-runtimes-open-17-jre-focal + - BASE_IMAGE=know-how.download/jre:openjdk-21-slim-bookworm - BUILD_VERSION=${DRONE_COMMIT} tags : - ${DRONE_BRANCH:22}-${CI_BUILD_NUMBER} @@ -260,7 +256,7 @@ steps : registry : know-how.download force_tag : true build_args : - - BASE_IMAGE=know-how.download/jre:ibm-semeru-runtimes-open-17-jre-focal + - BASE_IMAGE=know-how.download/jre:openjdk-21-slim-bookworm - BUILD_VERSION=${DRONE_COMMIT} tags : - ${DRONE_BRANCH:22}-${CI_BUILD_NUMBER} @@ -285,7 +281,7 @@ steps : registry : know-how.download force_tag : true build_args : - - BASE_IMAGE=know-how.download/jre:ibm-semeru-runtimes-open-17-jre-focal + - BASE_IMAGE=know-how.download/jre:openjdk-21-slim-bookworm - BUILD_VERSION=${DRONE_COMMIT} tags : - ${DRONE_BRANCH:22}-${CI_BUILD_NUMBER} @@ -310,7 +306,7 @@ steps : registry : know-how.download force_tag : true build_args : - - BASE_IMAGE=know-how.download/jre:ibm-semeru-runtimes-open-17-jre-focal + - BASE_IMAGE=know-how.download/jre:openjdk-21-slim-bookworm - BUILD_VERSION=${DRONE_COMMIT} tags : - ${DRONE_BRANCH:22}-${CI_BUILD_NUMBER} @@ -335,7 +331,7 @@ steps : registry : know-how.download force_tag : true build_args : - - BASE_IMAGE=know-how.download/jre:ibm-semeru-runtimes-open-17-jre-focal + - BASE_IMAGE=know-how.download/jre:openjdk-21-slim-bookworm - BUILD_VERSION=${DRONE_COMMIT} tags : - ${DRONE_BRANCH:22}-${CI_BUILD_NUMBER} @@ -360,7 +356,7 @@ steps : registry : know-how.download force_tag : true build_args : - - BASE_IMAGE=know-how.download/jre:ibm-semeru-runtimes-open-17-jre-focal + - BASE_IMAGE=know-how.download/jre:openjdk-21-slim-bookworm - BUILD_VERSION=${DRONE_COMMIT} tags : - ${DRONE_BRANCH:22}-${CI_BUILD_NUMBER} @@ -385,7 +381,7 @@ steps : registry : know-how.download force_tag : true build_args : - - BASE_IMAGE=know-how.download/jre:ibm-semeru-runtimes-open-17-jre-focal + - BASE_IMAGE=know-how.download/jre:openjdk-21-slim-bookworm - BUILD_VERSION=${DRONE_COMMIT} tags : - ${DRONE_TAG} @@ -410,7 +406,7 @@ steps : registry : know-how.download force_tag : true build_args : - - BASE_IMAGE=know-how.download/jre:ibm-semeru-runtimes-open-17-jre-focal + - BASE_IMAGE=know-how.download/jre:openjdk-21-slim-bookworm - BUILD_VERSION=${DRONE_COMMIT} tags : - ${DRONE_TAG} @@ -435,7 +431,7 @@ steps : registry : know-how.download force_tag : true build_args : - - BASE_IMAGE=know-how.download/jre:ibm-semeru-runtimes-open-17-jre-focal + - BASE_IMAGE=know-how.download/jre:openjdk-21-slim-bookworm - BUILD_VERSION=${DRONE_COMMIT} tags : - ${DRONE_TAG} @@ -460,7 +456,7 @@ steps : registry : know-how.download force_tag : true build_args : - - BASE_IMAGE=know-how.download/jre:ibm-semeru-runtimes-open-17-jre-focal + - BASE_IMAGE=know-how.download/jre:openjdk-21-slim-bookworm - BUILD_VERSION=${DRONE_COMMIT} tags : - ${DRONE_TAG} @@ -485,7 +481,7 @@ steps : registry : know-how.download force_tag : true build_args : - - BASE_IMAGE=know-how.download/jre:ibm-semeru-runtimes-open-17-jre-focal + - BASE_IMAGE=know-how.download/jre:openjdk-21-slim-bookworm - BUILD_VERSION=${DRONE_COMMIT} tags : - ${DRONE_TAG} @@ -510,7 +506,7 @@ steps : registry : know-how.download force_tag : true build_args : - - BASE_IMAGE=know-how.download/jre:ibm-semeru-runtimes-open-17-jre-focal + - BASE_IMAGE=know-how.download/jre:openjdk-21-slim-bookworm - BUILD_VERSION=${DRONE_COMMIT} tags : - ${DRONE_TAG} @@ -534,7 +530,7 @@ trigger : steps : - name : deploy - image : know-how.download/svc-builder:ibm-semeru-runtimes-open-17-jdk-focal + image : know-how.download/svc-builder:openjdk-21-slim-bookworm pull : if-not-exists environment : HELM_CHARTS_REPOSITORY : @@ -579,7 +575,7 @@ trigger : steps : - name : rollback - image : know-how.download/svc-builder:ibm-semeru-runtimes-open-17-jdk-focal + image : know-how.download/svc-builder:openjdk-21-slim-bookworm pull : if-not-exists environment : HELM_CHARTS_REPOSITORY : @@ -604,7 +600,7 @@ trigger : steps : - name : deploy - image : know-how.download/svc-builder:ibm-semeru-runtimes-open-17-jdk-focal + image : know-how.download/svc-builder:openjdk-21-slim-bookworm pull : if-not-exists environment : HELM_CHARTS_REPOSITORY : @@ -630,7 +626,7 @@ trigger : steps : - name : rollback - image : know-how.download/svc-builder:ibm-semeru-runtimes-open-17-jdk-focal + image : know-how.download/svc-builder:openjdk-21-slim-bookworm pull : if-not-exists environment : HELM_CHARTS_REPOSITORY : @@ -660,7 +656,7 @@ volumes : steps : - name : create-release-tag failure : ignore - image : know-how.download/svc-builder:ibm-semeru-runtimes-open-17-jdk-focal + image : know-how.download/svc-builder:openjdk-21-slim-bookworm pull : if-not-exists volumes : - name : m2cache @@ -668,9 +664,9 @@ steps : commands : - echo Prepare new version ${RELEASE_VERSION} - export NEXT_SNAPSHOT=${SNAPSHOT_VERSION}-SNAPSHOT - - export GIT_AUTHOR_NAME=$${SVC_BUILD_GIT_USERNAME} + - export GIT_AUTHOR_NAME="$${SVC_BUILD_GIT_USERNAME}" - export GIT_AUTHOR_EMAIL=$${SVC_BUILD_GIT_EMAIL} - - export GIT_COMMITTER_NAME=$${SVC_BUILD_GIT_USERNAME} + - export GIT_COMMITTER_NAME="$${SVC_BUILD_GIT_USERNAME}" - export GIT_COMMITTER_EMAIL=$${SVC_BUILD_GIT_EMAIL} - git remote set-url --push origin ${DRONE_GIT_SSH_URL} - git checkout -b v${RELEASE_VERSION} diff --git a/.github/workflows/check-commit-message.yml b/.github/workflows/check-commit-message.yml index 9cf5bf3..0647443 100644 --- a/.github/workflows/check-commit-message.yml +++ b/.github/workflows/check-commit-message.yml @@ -28,7 +28,7 @@ jobs : with : pattern : '^(feat|fix|docs|style|refactor|perf|test|chore|build)(.+?)?: .+' flags : 'gm' - error : 'Your commit title did not follow semantic versioning. Please see https://github.com/ujar-org/.github/blob/develop/SEMANTIC_COMMITS.md' + error : 'Your commit title did not follow semantic versioning. Please see https://github.com/uJarOrg/.github/blob/develop/SEMANTIC_COMMITS.md' - name : Check Line Length uses : gsactions/commit-message-checker@v2 with : diff --git a/README.md b/README.md index 2fec0e6..9845de6 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ with department information. ### Technology stack -Java 17, Maven 3, Spring Boot 2.7, Spring Cloud 2021.0.3 +java 21, Maven 3, Spring Boot 2.7, Spring Cloud 2021.0.3 mongo:5.0, mysql:5.7.41, zipkin-slim:2.23. _Including utils:_ liquibase, WireMock, Mongodb & Mysql testcontainers, docker-compose._dev_.yml, diff --git a/api-gateway/pom.xml b/api-gateway/pom.xml index 8294fb7..65e1d3f 100644 --- a/api-gateway/pom.xml +++ b/api-gateway/pom.xml @@ -18,7 +18,7 @@ - 17 + 21 ${java.version} ${java.version} **/*Application.java diff --git a/config-server/pom.xml b/config-server/pom.xml index e0174d4..e4d18e6 100644 --- a/config-server/pom.xml +++ b/config-server/pom.xml @@ -18,7 +18,7 @@ - 17 + 21 ${java.version} ${java.version} **/*Application.java diff --git a/department-service/pom.xml b/department-service/pom.xml index 7e0cd99..1253d9d 100644 --- a/department-service/pom.xml +++ b/department-service/pom.xml @@ -18,7 +18,7 @@ - 17 + 21 ${java.version} ${java.version} **/*Application.java diff --git a/hystrix-dashboard/pom.xml b/hystrix-dashboard/pom.xml index afd7c7a..60da338 100644 --- a/hystrix-dashboard/pom.xml +++ b/hystrix-dashboard/pom.xml @@ -18,7 +18,7 @@ - 17 + 21 ${java.version} ${java.version} **/*Application.java diff --git a/package.json b/package.json index ddab38b..86144c5 100644 --- a/package.json +++ b/package.json @@ -10,9 +10,9 @@ "license": "Apache-2.0", "devDependencies": { "husky": "8.0.3", - "prettier": "2.8.4", - "prettier-plugin-java": "2.1.0", - "prettier-plugin-packagejson": "2.4.3" + "prettier": "3.0.3", + "prettier-plugin-java": "2.3.1", + "prettier-plugin-packagejson": "2.4.6" }, "engines": { "node": ">=16.17.0" diff --git a/pom.xml b/pom.xml index 226807c..643c429 100644 --- a/pom.xml +++ b/pom.xml @@ -35,18 +35,19 @@ org.springframework.boot spring-boot-starter-parent - 2.7.12 + 2.7.16 - 17 + 21 UTF-8 UTF-8 ${java.version} ${java.version} **/*Application.java - 2.7.12 + 2.7.16 + 1.18.30 4.24.0 2.21.1 @@ -58,7 +59,7 @@ 1.4.2 8.0.32 2.2.8.RELEASE - 3.0.4 + 3.0.5 2.7.0 2.16.1 3.3.1 @@ -69,9 +70,9 @@ 1.18.20.0 6.0.0 3.1.2 - 0.8.10 + 0.8.11 3.10.8 - 1.11.4 + 1.11.5 4.0.3 2.2.10.RELEASE 2.2.10.RELEASE @@ -197,6 +198,11 @@ hibernate-jcache ${hibernate.version} + + org.projectlombok + lombok + ${lombok.version} + com.playtika.testcontainers embedded-mysql @@ -422,6 +428,13 @@ + + + org.projectlombok + lombok + ${lombok.version} + + org.apache.maven.plugins diff --git a/service-registry/pom.xml b/service-registry/pom.xml index 9ccbd92..c0d2356 100644 --- a/service-registry/pom.xml +++ b/service-registry/pom.xml @@ -18,7 +18,7 @@ - 17 + 21 ${java.version} ${java.version} **/*Application.java diff --git a/user-profile-service/pom.xml b/user-profile-service/pom.xml index 0c428c7..8015927 100644 --- a/user-profile-service/pom.xml +++ b/user-profile-service/pom.xml @@ -17,7 +17,7 @@ - 17 + 21 ${java.version} ${java.version} **/*Application.java