Skip to content

Commit

Permalink
feat: migrate to java 21
Browse files Browse the repository at this point in the history
  • Loading branch information
Dima Denysenko committed Oct 19, 2023
1 parent a0ed113 commit 7efc880
Show file tree
Hide file tree
Showing 11 changed files with 56 additions and 47 deletions.
56 changes: 26 additions & 30 deletions .drone/pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 :
Expand All @@ -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 :
Expand All @@ -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
Expand Down Expand Up @@ -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 :
Expand All @@ -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 :
Expand Down Expand Up @@ -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 :
Expand All @@ -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}
Expand All @@ -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}
Expand All @@ -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}
Expand All @@ -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}
Expand All @@ -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}
Expand All @@ -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}
Expand All @@ -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}
Expand All @@ -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}
Expand All @@ -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}
Expand All @@ -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}
Expand All @@ -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}
Expand All @@ -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}
Expand All @@ -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 :
Expand Down Expand Up @@ -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 :
Expand All @@ -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 :
Expand All @@ -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 :
Expand Down Expand Up @@ -660,17 +656,17 @@ 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
path : /root/.m2
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}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/check-commit-message.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 :
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion api-gateway/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
</parent>

<properties>
<java.version>17</java.version>
<java.version>21</java.version>
<maven.compiler.source>${java.version}</maven.compiler.source>
<maven.compiler.target>${java.version}</maven.compiler.target>
<sonar.exclusions>**/*Application.java</sonar.exclusions>
Expand Down
2 changes: 1 addition & 1 deletion config-server/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
</parent>

<properties>
<java.version>17</java.version>
<java.version>21</java.version>
<maven.compiler.source>${java.version}</maven.compiler.source>
<maven.compiler.target>${java.version}</maven.compiler.target>
<sonar.exclusions>**/*Application.java</sonar.exclusions>
Expand Down
2 changes: 1 addition & 1 deletion department-service/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
</parent>

<properties>
<java.version>17</java.version>
<java.version>21</java.version>
<maven.compiler.source>${java.version}</maven.compiler.source>
<maven.compiler.target>${java.version}</maven.compiler.target>
<sonar.exclusions>**/*Application.java</sonar.exclusions>
Expand Down
2 changes: 1 addition & 1 deletion hystrix-dashboard/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
</parent>

<properties>
<java.version>17</java.version>
<java.version>21</java.version>
<maven.compiler.source>${java.version}</maven.compiler.source>
<maven.compiler.target>${java.version}</maven.compiler.target>
<sonar.exclusions>**/*Application.java</sonar.exclusions>
Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
25 changes: 19 additions & 6 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -35,18 +35,19 @@
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.7.12</version>
<version>2.7.16</version>
<relativePath/>
</parent>

<properties>
<java.version>17</java.version>
<java.version>21</java.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<maven.compiler.source>${java.version}</maven.compiler.source>
<maven.compiler.target>${java.version}</maven.compiler.target>
<sonar.exclusions>**/*Application.java</sonar.exclusions>
<spring-boot.version>2.7.12</spring-boot.version>
<spring-boot.version>2.7.16</spring-boot.version>
<lombok.version>1.18.30</lombok.version>

<liquibase.version>4.24.0</liquibase.version>
<vladmihalcea.hibernate-types.version>2.21.1</vladmihalcea.hibernate-types.version>
Expand All @@ -58,7 +59,7 @@
<loki-logback-appender.version>1.4.2</loki-logback-appender.version>
<mysql-connector.version>8.0.32</mysql-connector.version>
<zipkin.version>2.2.8.RELEASE</zipkin.version>
<playtika.testcontainers.version>3.0.4</playtika.testcontainers.version>
<playtika.testcontainers.version>3.0.5</playtika.testcontainers.version>
<gaul.modernizer-maven-plugin.version>2.7.0</gaul.modernizer-maven-plugin.version>
<codehaus.versions-maven-plugin.version>2.16.1</codehaus.versions-maven-plugin.version>
<maven-resources-plugin.version>3.3.1</maven-resources-plugin.version>
Expand All @@ -69,9 +70,9 @@
<lombok-maven-plugin.version>1.18.20.0</lombok-maven-plugin.version>
<git-commit-id-plugin.version>6.0.0</git-commit-id-plugin.version>
<maven-surefire-plugin.version>3.1.2</maven-surefire-plugin.version>
<jacoco-maven-plugin.version>0.8.10</jacoco-maven-plugin.version>
<jacoco-maven-plugin.version>0.8.11</jacoco-maven-plugin.version>
<ehcache.version>3.10.8</ehcache.version>
<micrometer.version>1.11.4</micrometer.version>
<micrometer.version>1.11.5</micrometer.version>
<eureka.version>4.0.3</eureka.version>
<hystrix.version>2.2.10.RELEASE</hystrix.version>
<zuul.version>2.2.10.RELEASE</zuul.version>
Expand Down Expand Up @@ -197,6 +198,11 @@
<artifactId>hibernate-jcache</artifactId>
<version>${hibernate.version}</version>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>${lombok.version}</version>
</dependency>
<dependency>
<groupId>com.playtika.testcontainers</groupId>
<artifactId>embedded-mysql</artifactId>
Expand Down Expand Up @@ -422,6 +428,13 @@
</goals>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>${lombok.version}</version>
</dependency>
</dependencies>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
Expand Down
2 changes: 1 addition & 1 deletion service-registry/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
</parent>

<properties>
<java.version>17</java.version>
<java.version>21</java.version>
<maven.compiler.source>${java.version}</maven.compiler.source>
<maven.compiler.target>${java.version}</maven.compiler.target>
<sonar.exclusions>**/*Application.java</sonar.exclusions>
Expand Down
Loading

0 comments on commit 7efc880

Please sign in to comment.