From 5503dc572badee2916c0c6936d177aecacb67281 Mon Sep 17 00:00:00 2001 From: siujamo Date: Thu, 24 Apr 2025 11:43:41 +0800 Subject: [PATCH] refactor: changed to version catalogue and upgraded dependencies --- devkit-core/build.gradle.kts | 7 ++-- devkit-utils/build.gradle.kts | 14 ++----- gradle.properties | 10 +---- gradle/libs.versions.toml | 21 ++++++++++ guid/build.gradle.kts | 14 ++----- key-pair-loader/build.gradle.kts | 14 ++----- map-util-unsafe/build.gradle.kts | 14 ++----- num4j/build.gradle.kts | 14 ++----- .../build.gradle.kts | 24 +++++------- simple-jwt-authzero/build.gradle.kts | 25 +++++------- simple-jwt-facade/build.gradle.kts | 17 +++------ .../build.gradle.kts | 32 ++++++---------- simple-jwt/build.gradle.kts | 38 +++++++++++++++---- .../build.gradle.kts | 29 +++++--------- 14 files changed, 121 insertions(+), 152 deletions(-) create mode 100644 gradle/libs.versions.toml diff --git a/devkit-core/build.gradle.kts b/devkit-core/build.gradle.kts index f71a423..a8cb743 100644 --- a/devkit-core/build.gradle.kts +++ b/devkit-core/build.gradle.kts @@ -56,11 +56,10 @@ dependencies { val logbackVersion: String by project val junitVersion: String by project - compileOnly("org.slf4j:slf4j-api:$slf4jVersion") - implementation("ch.qos.logback:logback-classic:$logbackVersion") + compileOnly(libs.slf4j) + implementation(libs.logback) - testCompileOnly("org.slf4j:slf4j-api:$slf4jVersion") - testImplementation("org.junit.jupiter:junit-jupiter:$junitVersion") + testImplementation(libs.junit) } tasks.test { diff --git a/devkit-utils/build.gradle.kts b/devkit-utils/build.gradle.kts index 190d2e4..34a4ceb 100644 --- a/devkit-utils/build.gradle.kts +++ b/devkit-utils/build.gradle.kts @@ -52,16 +52,10 @@ tasks.withType { } dependencies { - val slf4jVersion: String by project - val logbackVersion: String by project - val junitVersion: String by project - - compileOnly("org.slf4j:slf4j-api:$slf4jVersion") - implementation("ch.qos.logback:logback-classic:$logbackVersion") - implementation(project(":devkit-core")) - - testCompileOnly("org.slf4j:slf4j-api:$slf4jVersion") - testImplementation("org.junit.jupiter:junit-jupiter:$junitVersion") + compileOnly(libs.slf4j) + implementation(libs.logback) + api(project(":devkit-core")) + testImplementation(libs.junit) } tasks.test { diff --git a/gradle.properties b/gradle.properties index 4856c15..ac0191f 100644 --- a/gradle.properties +++ b/gradle.properties @@ -19,12 +19,4 @@ artefactVersion=2.1.0 projectUrl=https://onixbyte.com/JDevKit projectGithubUrl=https://github.com/OnixByte/JDevKit licenseName=The Apache License, Version 2.0 -licenseUrl=https://www.apache.org/licenses/LICENSE-2.0.txt - -jacksonVersion=2.18.2 -javaJwtVersion=4.4.0 -junitVersion=5.11.4 -logbackVersion=1.5.16 -slf4jVersion=2.0.16 -springVersion=6.2.2 -springBootVersion=3.4.2 \ No newline at end of file +licenseUrl=https://www.apache.org/licenses/LICENSE-2.0.txt \ No newline at end of file diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml new file mode 100644 index 0000000..08a2190 --- /dev/null +++ b/gradle/libs.versions.toml @@ -0,0 +1,21 @@ +[versions] +slf4j = "2.0.17" +logback = "1.5.18" +jackson = "2.18.3" +jwt = "4.5.0" +spring = "6.2.6" +springBoot = "3.4.4" +junit = "5.12.2" + +[libraries] +slf4j = { group = "org.slf4j", name = "slf4j-api", version.ref = "slf4j" } +logback = { group = "ch.qos.logback", name = "logback-classic", version.ref = "logback" } +jackson-core = { group = "com.fasterxml.jackson.core", name = "jackson-core", version.ref = "jackson" } +jackson-databind = { group = "com.fasterxml.jackson.core", name = "jackson-databind", version.ref = "jackson" } +jwt = { group = "com.auth0", name = "java-jwt", version.ref = "jwt"} +spring-boot-autoconfigure = { group = "org.springframework.boot", name = "spring-boot-autoconfigure", version.ref = "springBoot" } +spring-boot-starter-logging = { group = "org.springframework.boot", name = "spring-boot-starter-logging", version.ref = "springBoot" } +spring-boot-configuration-processor = { group = "org.springframework.boot", name = "spring-boot-configuration-processor", version.ref = "springBoot" } +spring-boot-starter-redis = { group = "org.springframework.boot", name = "spring-boot-starter-data-redis", version.ref = "springBoot" } +spring-boot-starter-test = { group = "org.springframework.boot", name = "spring-boot-starter-test", version.ref = "springBoot" } +junit = { group = "org.junit.jupiter", name = "junit-jupiter", version.ref = "junit" } diff --git a/guid/build.gradle.kts b/guid/build.gradle.kts index 84cda10..acde71a 100644 --- a/guid/build.gradle.kts +++ b/guid/build.gradle.kts @@ -52,16 +52,10 @@ tasks.withType { } dependencies { - val slf4jVersion: String by project - val logbackVersion: String by project - val junitVersion: String by project - - compileOnly("org.slf4j:slf4j-api:$slf4jVersion") - implementation("ch.qos.logback:logback-classic:$logbackVersion") - implementation(project(":devkit-core")) - - testCompileOnly("org.slf4j:slf4j-api:$slf4jVersion") - testImplementation("org.junit.jupiter:junit-jupiter:$junitVersion") + compileOnly(libs.slf4j) + implementation(libs.logback) + api(project(":devkit-core")) + testImplementation(libs.junit) } tasks.test { diff --git a/key-pair-loader/build.gradle.kts b/key-pair-loader/build.gradle.kts index 22e769c..a77dbb4 100644 --- a/key-pair-loader/build.gradle.kts +++ b/key-pair-loader/build.gradle.kts @@ -52,16 +52,10 @@ tasks.withType { } dependencies { - val slf4jVersion: String by project - val logbackVersion: String by project - val junitVersion: String by project - - compileOnly("org.slf4j:slf4j-api:$slf4jVersion") - implementation("ch.qos.logback:logback-classic:$logbackVersion") - implementation(project(":devkit-core")) - - testCompileOnly("org.slf4j:slf4j-api:$slf4jVersion") - testImplementation("org.junit.jupiter:junit-jupiter:$junitVersion") + compileOnly(libs.slf4j) + implementation(libs.logback) + api(project(":devkit-core")) + testImplementation(libs.junit) } tasks.test { diff --git a/map-util-unsafe/build.gradle.kts b/map-util-unsafe/build.gradle.kts index 7d46c88..c3ce32b 100644 --- a/map-util-unsafe/build.gradle.kts +++ b/map-util-unsafe/build.gradle.kts @@ -52,16 +52,10 @@ tasks.withType { } dependencies { - val slf4jVersion: String by project - val logbackVersion: String by project - val junitVersion: String by project - - compileOnly("org.slf4j:slf4j-api:$slf4jVersion") - implementation("ch.qos.logback:logback-classic:$logbackVersion") - implementation(project(":devkit-core")) - - testCompileOnly("org.slf4j:slf4j-api:$slf4jVersion") - testImplementation("org.junit.jupiter:junit-jupiter:$junitVersion") + compileOnly(libs.slf4j) + implementation(libs.logback) + api(project(":devkit-core")) + testImplementation(libs.junit) } tasks.test { diff --git a/num4j/build.gradle.kts b/num4j/build.gradle.kts index 60c0bd2..267689c 100644 --- a/num4j/build.gradle.kts +++ b/num4j/build.gradle.kts @@ -52,16 +52,10 @@ tasks.withType { } dependencies { - val slf4jVersion: String by project - val logbackVersion: String by project - val junitVersion: String by project - - compileOnly("org.slf4j:slf4j-api:$slf4jVersion") - implementation("ch.qos.logback:logback-classic:$logbackVersion") - implementation(project(":devkit-core")) - - testCompileOnly("org.slf4j:slf4j-api:$slf4jVersion") - testImplementation("org.junit.jupiter:junit-jupiter:$junitVersion") + compileOnly(libs.slf4j) + implementation(libs.logback) + api(project(":devkit-core")) + testImplementation(libs.junit) } tasks.test { diff --git a/property-guard-spring-boot-starter/build.gradle.kts b/property-guard-spring-boot-starter/build.gradle.kts index 8db0a5e..4d80cd0 100644 --- a/property-guard-spring-boot-starter/build.gradle.kts +++ b/property-guard-spring-boot-starter/build.gradle.kts @@ -52,22 +52,16 @@ tasks.withType { } dependencies { - val slf4jVersion: String by project - val logbackVersion: String by project - val junitVersion: String by project - val springBootVersion: String by project + compileOnly(libs.slf4j) + implementation(libs.logback) + api(project(":devkit-core")) + api(project(":devkit-utils")) + implementation(libs.spring.boot.autoconfigure) + implementation(libs.spring.boot.starter.logging) + implementation(libs.spring.boot.configuration.processor) - compileOnly("org.slf4j:slf4j-api:$slf4jVersion") - implementation("ch.qos.logback:logback-classic:$logbackVersion") - implementation(project(":devkit-core")) - implementation(project(":devkit-utils")) - implementation("org.springframework.boot:spring-boot-autoconfigure:$springBootVersion") - implementation("org.springframework.boot:spring-boot-starter-logging:$springBootVersion") - implementation("org.springframework.boot:spring-boot-configuration-processor:$springBootVersion") - - testImplementation("org.springframework.boot:spring-boot-starter-test:$springBootVersion") - testCompileOnly("org.slf4j:slf4j-api:$slf4jVersion") - testImplementation("org.junit.jupiter:junit-jupiter:$junitVersion") + testImplementation(libs.junit) + testImplementation(libs.spring.boot.starter.test) } tasks.test { diff --git a/simple-jwt-authzero/build.gradle.kts b/simple-jwt-authzero/build.gradle.kts index 0a9e4a0..524df93 100644 --- a/simple-jwt-authzero/build.gradle.kts +++ b/simple-jwt-authzero/build.gradle.kts @@ -52,24 +52,17 @@ tasks.withType { } dependencies { - val slf4jVersion: String by project - val logbackVersion: String by project - val junitVersion: String by project - val jacksonVersion: String by project - val javaJwtVersion: String by project + compileOnly(libs.slf4j) + implementation(libs.logback) - compileOnly("org.slf4j:slf4j-api:$slf4jVersion") - implementation("ch.qos.logback:logback-classic:$logbackVersion") + api(project(":devkit-utils")) + api(project(":guid")) + api(project(":key-pair-loader")) + api(project(":simple-jwt-facade")) + api(libs.jackson.databind) + api(libs.jwt) - implementation(project(":devkit-utils")) - implementation(project(":guid")) - implementation(project(":key-pair-loader")) - implementation(project(":simple-jwt-facade")) - implementation("com.fasterxml.jackson.core:jackson-databind:$jacksonVersion") - implementation("com.auth0:java-jwt:$javaJwtVersion") - - testCompileOnly("org.slf4j:slf4j-api:$slf4jVersion") - testImplementation("org.junit.jupiter:junit-jupiter:$junitVersion") + testImplementation(libs.junit) } tasks.test { diff --git a/simple-jwt-facade/build.gradle.kts b/simple-jwt-facade/build.gradle.kts index 147d9fd..ce7b130 100644 --- a/simple-jwt-facade/build.gradle.kts +++ b/simple-jwt-facade/build.gradle.kts @@ -52,19 +52,14 @@ tasks.withType { } dependencies { - val slf4jVersion: String by project - val logbackVersion: String by project - val junitVersion: String by project + compileOnly(libs.slf4j) + implementation(libs.logback) - compileOnly("org.slf4j:slf4j-api:$slf4jVersion") - implementation("ch.qos.logback:logback-classic:$logbackVersion") + api(project(":devkit-core")) + api(project(":devkit-utils")) + api(project(":guid")) - implementation(project(":devkit-core")) - implementation(project(":devkit-utils")) - implementation(project(":guid")) - - testCompileOnly("org.slf4j:slf4j-api:$slf4jVersion") - testImplementation("org.junit.jupiter:junit-jupiter:$junitVersion") + testImplementation(libs.junit) } tasks.test { diff --git a/simple-jwt-spring-boot-starter/build.gradle.kts b/simple-jwt-spring-boot-starter/build.gradle.kts index 5e9a94d..b560d47 100644 --- a/simple-jwt-spring-boot-starter/build.gradle.kts +++ b/simple-jwt-spring-boot-starter/build.gradle.kts @@ -52,29 +52,19 @@ tasks.withType { } dependencies { - val slf4jVersion: String by project - val logbackVersion: String by project - val junitVersion: String by project - val javaJwtVersion: String by project - val jacksonVersion: String by project - val springBootVersion: String by project + compileOnly(libs.slf4j) + implementation(libs.logback) - compileOnly("org.slf4j:slf4j-api:$slf4jVersion") - implementation("ch.qos.logback:logback-classic:$logbackVersion") + api(project(":guid")) + api(project(":simple-jwt-facade")) + api(project(":simple-jwt-authzero")) + implementation(libs.spring.boot.autoconfigure) + implementation(libs.spring.boot.starter.logging) + implementation(libs.spring.boot.configuration.processor) + annotationProcessor(libs.spring.boot.configuration.processor) - implementation(project(":guid")) - implementation(project(":simple-jwt-facade")) - compileOnly("com.auth0:java-jwt:$javaJwtVersion") - compileOnly(project(":simple-jwt-authzero")) - implementation("com.fasterxml.jackson.core:jackson-databind:$jacksonVersion") - implementation("org.springframework.boot:spring-boot-autoconfigure:$springBootVersion") - implementation("org.springframework.boot:spring-boot-starter-logging:$springBootVersion") - implementation("org.springframework.boot:spring-boot-configuration-processor:$springBootVersion") - annotationProcessor("org.springframework.boot:spring-boot-configuration-processor:$springBootVersion") - - testCompileOnly("org.slf4j:slf4j-api:$slf4jVersion") - testImplementation("org.junit.jupiter:junit-jupiter:$junitVersion") - testImplementation("org.springframework.boot:spring-boot-starter-test:$springBootVersion") + testImplementation(libs.junit) + testImplementation(libs.spring.boot.starter.test) } java { diff --git a/simple-jwt/build.gradle.kts b/simple-jwt/build.gradle.kts index cf66377..73f54dc 100644 --- a/simple-jwt/build.gradle.kts +++ b/simple-jwt/build.gradle.kts @@ -1,8 +1,32 @@ +/* + * Copyright (C) 2024-2024 OnixByte. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * + * See the License for the specific language governing permissions and + * limitations under the License. + */ + plugins { id("java") + id("java-library") + id("maven-publish") + id("signing") } val artefactVersion: String by project +val projectUrl: String by project +val projectGithubUrl: String by project +val licenseName: String by project +val licenseUrl: String by project group = "com.onixbyte" version = artefactVersion @@ -12,13 +36,13 @@ repositories { } dependencies { - val jacksonVersion: String by project - implementation(project(":devkit-core")) - implementation(project(":devkit-utils")) - implementation("com.fasterxml.jackson.core:jackson-core:$jacksonVersion") - implementation("com.fasterxml.jackson.core:jackson-databind:$jacksonVersion") - testImplementation(platform("org.junit:junit-bom:5.10.0")) - testImplementation("org.junit.jupiter:junit-jupiter") + compileOnly(libs.slf4j) + implementation(libs.logback) + api(project(":devkit-core")) + api(project(":devkit-utils")) + implementation(libs.jackson.core) + implementation(libs.jackson.databind) + testImplementation(libs.junit) } tasks.test { diff --git a/simple-serial-spring-boot-starter/build.gradle.kts b/simple-serial-spring-boot-starter/build.gradle.kts index a2e1961..247f140 100644 --- a/simple-serial-spring-boot-starter/build.gradle.kts +++ b/simple-serial-spring-boot-starter/build.gradle.kts @@ -52,27 +52,18 @@ tasks.withType { } dependencies { - val slf4jVersion: String by project - val logbackVersion: String by project - val junitVersion: String by project - val jacksonVersion: String by project - val springBootVersion: String by project + compileOnly(libs.slf4j) + implementation(libs.logback) - compileOnly("org.slf4j:slf4j-api:$slf4jVersion") - implementation("ch.qos.logback:logback-classic:$logbackVersion") + implementation(libs.jackson.databind) + implementation(libs.spring.boot.autoconfigure) + implementation(libs.spring.boot.starter.logging) + implementation(libs.spring.boot.configuration.processor) + implementation(libs.spring.boot.starter.redis) + annotationProcessor(libs.spring.boot.configuration.processor) - implementation("com.fasterxml.jackson.core:jackson-databind:$jacksonVersion") - implementation("org.springframework.boot:spring-boot-autoconfigure:$springBootVersion") - implementation("org.springframework.boot:spring-boot-starter-logging:$springBootVersion") - implementation("org.springframework.boot:spring-boot-configuration-processor:$springBootVersion") - implementation("org.springframework.boot:spring-boot-starter-data-redis:$springBootVersion") - annotationProcessor("org.springframework.boot:spring-boot-configuration-processor:$springBootVersion") - - testCompileOnly("org.slf4j:slf4j-api:$slf4jVersion") - testImplementation("org.junit.jupiter:junit-jupiter:$junitVersion") - testImplementation("org.springframework.boot:spring-boot-starter-test:$springBootVersion") - testImplementation(platform("org.junit:junit-bom:5.10.0")) - testImplementation("org.junit.jupiter:junit-jupiter") + testImplementation(libs.junit) + testImplementation(libs.spring.boot.starter.test) } tasks.test {