From bc875097dabe2efe766781ea7c2f21295da006a4 Mon Sep 17 00:00:00 2001 From: "emmanuel.duchastenier@bonitasoft.com" Date: Tue, 18 Jun 2024 17:35:33 +0200 Subject: [PATCH] chore(version catalog): convert a few libs (#3038) * chore(version catalog): convert quartz * chore(version catalog): convert micrometer * chore(version catalog): convert jdbc drivers --- bonita-engine-standalone/build.gradle | 8 ++++--- bonita-engine/build.gradle | 4 ++-- .../benchmarks/build.gradle | 3 --- .../build.gradle | 3 --- .../bonita-process-engine/build.gradle | 2 +- buildSrc/src/main/groovy/Deps.groovy | 8 ------- .../gradle/docker/DockerDatabasePlugin.groovy | 23 ++++++++++-------- .../docker/JdbcDriverDependencies.groovy | 24 ------------------- gradle/libs.versions.toml | 16 ++++++++++++- platform/platform-setup/build.gradle | 10 ++++---- .../bonita-business-data-impl/build.gradle | 5 +--- services/bonita-commons/build.gradle | 2 +- services/bonita-scheduler/build.gradle | 4 ++-- 13 files changed, 45 insertions(+), 67 deletions(-) delete mode 100644 buildSrc/src/main/groovy/org/bonitasoft/engine/gradle/docker/JdbcDriverDependencies.groovy diff --git a/bonita-engine-standalone/build.gradle b/bonita-engine-standalone/build.gradle index f349c309c44..0ba01b92719 100644 --- a/bonita-engine-standalone/build.gradle +++ b/bonita-engine-standalone/build.gradle @@ -24,9 +24,11 @@ dependencies { testImplementation "org.assertj:assertj-core:${Deps.assertjVersion}" testImplementation "junit:junit:${Deps.junit4Version}" testImplementation "com.github.stefanbirkner:system-rules:${Deps.systemRulesVersion}" - testImplementation "org.postgresql:postgresql:${Deps.postgresqlVersion}" - testImplementation "com.mysql:mysql-connector-j:${Deps.mysqlVersion}" - testImplementation libs.h2 + + // These 3 drivers are used for some specific tests: + testImplementation(libs.postgresql) + testImplementation(libs.mysql) + testImplementation(libs.h2) } diff --git a/bonita-engine/build.gradle b/bonita-engine/build.gradle index e0c1d8d6013..51f17966cf8 100644 --- a/bonita-engine/build.gradle +++ b/bonita-engine/build.gradle @@ -51,10 +51,10 @@ dependencyManagement { dependency libs.tomcatDbcp.get() as String dependency "org.jboss.narayana.jta:narayana-jta:${Deps.narayanaVersion}" dependency libs.jakartaActivation.get() as String - dependency("org.quartz-scheduler:quartz:${Deps.quartzVersion}") + dependency(libs.quartz.get() as String) dependency(libs.eclipseCompiler.get() as String) dependency("javax.annotation:javax.annotation-api:$Deps.javaxAnnotationsVersion") - dependencySet(group: "io.micrometer", version: Deps.micrometerVersion) { + dependencySet(group: "io.micrometer", version: libs.versions.micrometerVersion.get()) { entry "micrometer-core" entry "micrometer-registry-jmx" entry "micrometer-registry-prometheus" diff --git a/bonita-integration-tests/benchmarks/build.gradle b/bonita-integration-tests/benchmarks/build.gradle index 86681c9e4a7..e37f187213f 100644 --- a/bonita-integration-tests/benchmarks/build.gradle +++ b/bonita-integration-tests/benchmarks/build.gradle @@ -8,9 +8,6 @@ dependencies { api "org.mockito:mockito-core:${Deps.mockitoVersion}" api project(':bonita-integration-tests:bonita-integration-tests-client') api project(':bpm:bonita-server') - runtimeOnly "com.mysql:mysql-connector-j:${Deps.mysqlVersion}" - runtimeOnly "com.microsoft.sqlserver:mssql-jdbc:${Deps.mssqlVersion}" - runtimeOnly "org.postgresql:postgresql:${Deps.postgresqlVersion}" testRuntimeOnly "ch.qos.logback:logback-classic:${Deps.logbackVersion}" } diff --git a/bonita-integration-tests/bonita-integration-tests-local/build.gradle b/bonita-integration-tests/bonita-integration-tests-local/build.gradle index ae448fdf578..5b557aa3360 100644 --- a/bonita-integration-tests/bonita-integration-tests-local/build.gradle +++ b/bonita-integration-tests/bonita-integration-tests-local/build.gradle @@ -10,9 +10,6 @@ dependencies { implementation(project(":bpm:bonita-core:bonita-process-engine")) api project(':bpm:bonita-server') api libs.commonsIO - runtimeOnly "com.mysql:mysql-connector-j:${Deps.mysqlVersion}" - runtimeOnly "com.microsoft.sqlserver:mssql-jdbc:${Deps.mssqlVersion}" - runtimeOnly "org.postgresql:postgresql:${Deps.postgresqlVersion}" testRuntimeOnly "ch.qos.logback:logback-classic:${Deps.logbackVersion}" testAnnotationProcessor libs.lombok testImplementation libs.lombok diff --git a/bpm/bonita-core/bonita-process-engine/build.gradle b/bpm/bonita-core/bonita-process-engine/build.gradle index ec3361290ce..11646f83e5e 100644 --- a/bpm/bonita-core/bonita-process-engine/build.gradle +++ b/bpm/bonita-core/bonita-process-engine/build.gradle @@ -64,7 +64,7 @@ dependencies { api libs.springSessionCore api libs.springWeb api libs.bundles.groovy - api "io.micrometer:micrometer-core:${Deps.micrometerVersion}" + api libs.micrometerCore // Dependency on javax.annotations as it is not provided anymore in Java 11: api("javax.annotation:javax.annotation-api:${Deps.javaxAnnotationsVersion}") diff --git a/buildSrc/src/main/groovy/Deps.groovy b/buildSrc/src/main/groovy/Deps.groovy index df577246646..e3b1ee4db1f 100644 --- a/buildSrc/src/main/groovy/Deps.groovy +++ b/buildSrc/src/main/groovy/Deps.groovy @@ -1,13 +1,5 @@ class Deps { - public static String quartzVersion = "2.3.2" - public static String micrometerVersion = "1.6.1" - - public static String mysqlVersion = "8.2.0" - public static String mssqlVersion = "8.4.1.jre8" - public static String oracleVersion = "19.3.0.0" - public static String postgresqlVersion = "42.4.4" - public static String narayanaVersion = "5.10.6.Final" public static String jaxbVersion = "2.3.1" public static String logbackVersion = "1.2.13" diff --git a/buildSrc/src/main/groovy/org/bonitasoft/engine/gradle/docker/DockerDatabasePlugin.groovy b/buildSrc/src/main/groovy/org/bonitasoft/engine/gradle/docker/DockerDatabasePlugin.groovy index 133d93a0ff7..dd49a13edbb 100644 --- a/buildSrc/src/main/groovy/org/bonitasoft/engine/gradle/docker/DockerDatabasePlugin.groovy +++ b/buildSrc/src/main/groovy/org/bonitasoft/engine/gradle/docker/DockerDatabasePlugin.groovy @@ -2,6 +2,8 @@ package org.bonitasoft.engine.gradle.docker import org.gradle.api.Plugin import org.gradle.api.Project +import org.gradle.api.artifacts.VersionCatalogsExtension + /** * @author Emmanuel Duchastenier */ @@ -13,7 +15,17 @@ class DockerDatabasePlugin implements Plugin { drivers } - defineJdbcDriversConfiguration(project) + project.dependencies { + // the following jdbc drivers are available for integration tests + drivers(project.extensions.getByType(VersionCatalogsExtension.class).named("libs") + .findLibrary("mysql").get()) + drivers(project.extensions.getByType(VersionCatalogsExtension.class).named("libs") + .findLibrary("oracle").get()) + drivers(project.extensions.getByType(VersionCatalogsExtension.class).named("libs") + .findLibrary("postgresql").get()) + drivers(project.extensions.getByType(VersionCatalogsExtension.class).named("libs") + .findLibrary("msSqlServer").get()) + } def databaseIntegrationTest = project.extensions.create("databaseIntegrationTest", DatabasePluginExtension) @@ -26,13 +38,4 @@ class DockerDatabasePlugin implements Plugin { } } - def defineJdbcDriversConfiguration(Project project) { - project.dependencies { - // the following jdbc drivers are available for integration tests - drivers JdbcDriverDependencies.mysql - drivers JdbcDriverDependencies.oracle - drivers JdbcDriverDependencies.postgres - drivers JdbcDriverDependencies.sqlserver - } - } } diff --git a/buildSrc/src/main/groovy/org/bonitasoft/engine/gradle/docker/JdbcDriverDependencies.groovy b/buildSrc/src/main/groovy/org/bonitasoft/engine/gradle/docker/JdbcDriverDependencies.groovy deleted file mode 100644 index c999a6b9749..00000000000 --- a/buildSrc/src/main/groovy/org/bonitasoft/engine/gradle/docker/JdbcDriverDependencies.groovy +++ /dev/null @@ -1,24 +0,0 @@ -/** - * Copyright (C) 2018 Bonitasoft S.A. - * BonitaSoft, 32 rue Gustave Eiffel - 38000 Grenoble - * This library is free software; you can redistribute it and/or modify it under the terms - * of the GNU Lesser General Public License as published by the Free Software Foundation - * version 2.1 of the License. - * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * See the GNU Lesser General Public License for more details. - * You should have received a copy of the GNU Lesser General Public License along with this - * program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth - * Floor, Boston, MA 02110-1301, USA. - **/ - -package org.bonitasoft.engine.gradle.docker - -class JdbcDriverDependencies { - - final static String mysql = "com.mysql:mysql-connector-j:${Deps.mysqlVersion}" - final static String oracle = "com.oracle.database.jdbc:ojdbc8:${Deps.oracleVersion}" - final static String postgres = "org.postgresql:postgresql:${Deps.postgresqlVersion}" - final static String sqlserver = "com.microsoft.sqlserver:mssql-jdbc:${Deps.mssqlVersion}" - -} diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index b1d8b7d42cd..f0aaecddf6c 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -29,6 +29,13 @@ xstreamVersion = "1.4.20" ehCacheVersion = "2.10.10.12.7" eclipseCompilerVersion = "3.38.0" jakartaActivationVersion = "1.2.2" +quartzVersion = "2.3.2" +micrometerVersion = "1.6.1" +# DB drivers: +mysqlVersion = "8.2.0" +msSqlServerVersion = "8.4.1.jre8" +oracleVersion = "19.3.0.0" +postgresqlVersion = "42.4.4" [libraries] springCore = { module = "org.springframework:spring-core", version.ref = "springVersion" } @@ -106,9 +113,16 @@ ehCache = { group = "net.sf.ehcache", name = "ehcache", version.ref = "ehCacheVe eclipseCompiler = { group = "org.eclipse.jdt", name = "ecj", version.ref = "eclipseCompilerVersion" } jakartaActivation = { group = "com.sun.activation", name = "jakarta.activation", version.ref = "jakartaActivationVersion" } - +quartz = { group = "org.quartz-scheduler", name = "quartz", version.ref = "quartzVersion" } +micrometerCore = { group = "io.micrometer", name = "micrometer-core", version.ref = "micrometerVersion" } +micrometerRegistryJmx = { group = "io.micrometer", name = "micrometer-registry-jmx", version.ref = "micrometerVersion" } +micrometerRegistryPrometheus = { group = "io.micrometer", name = "micrometer-registry-prometheus", version.ref = "micrometerVersion" } h2 = "com.h2database:h2:1.4.200" +mysql = { group = "com.mysql", name = "mysql-connector-j", version.ref = "mysqlVersion" } +msSqlServer = { group = "com.microsoft.sqlserver", name = "mssql-jdbc", version.ref = "msSqlServerVersion" } +oracle = { group = "com.oracle.database.jdbc", name = "ojdbc8", version.ref = "oracleVersion" } +postgresql = { group = "org.postgresql", name = "postgresql", version.ref = "postgresqlVersion" } lombok = "org.projectlombok:lombok:1.18.32" diff --git a/platform/platform-setup/build.gradle b/platform/platform-setup/build.gradle index b371c98ce11..eb7b6095191 100644 --- a/platform/platform-setup/build.gradle +++ b/platform/platform-setup/build.gradle @@ -20,13 +20,13 @@ dependencies { exclude(module: 'snakeyaml') } api libs.springBootStarterJdbc - api "org.postgresql:postgresql:${Deps.postgresqlVersion}" - api ("com.mysql:mysql-connector-j:${Deps.mysqlVersion}") { + api(libs.postgresql) + api(libs.mysql) { exclude(module: 'protobuf-java') } - api "com.microsoft.sqlserver:mssql-jdbc:${Deps.mssqlVersion}" - api libs.h2 - api("com.oracle.database.jdbc:ojdbc8:${Deps.oracleVersion}") { + api libs.msSqlServer + api(libs.h2) + api(libs.oracle) { exclude(module: "ons") exclude(module: "oraclepki") exclude(module: "osdt_cert") diff --git a/services/bonita-business-data/bonita-business-data-impl/build.gradle b/services/bonita-business-data/bonita-business-data-impl/build.gradle index 2ce6c4a3026..1f82ce9889b 100644 --- a/services/bonita-business-data/bonita-business-data-impl/build.gradle +++ b/services/bonita-business-data/bonita-business-data-impl/build.gradle @@ -26,10 +26,7 @@ dependencies { testImplementation libs.springJdbc testImplementation testFixtures(project(':bpm:bonita-common')) testRuntimeOnly libs.tomcatDbcp - testRuntimeOnly libs.h2 - testRuntimeOnly "com.mysql:mysql-connector-j:${Deps.mysqlVersion}" - testRuntimeOnly "org.postgresql:postgresql:${Deps.postgresqlVersion}" - testRuntimeOnly "com.microsoft.sqlserver:mssql-jdbc:${Deps.mssqlVersion}" + testRuntimeOnly(libs.h2) // Property Based Test framework: testImplementation("com.pholser:junit-quickcheck-core:${Deps.junitQuickCheck}") diff --git a/services/bonita-commons/build.gradle b/services/bonita-commons/build.gradle index 69e660f2a78..de74d420121 100644 --- a/services/bonita-commons/build.gradle +++ b/services/bonita-commons/build.gradle @@ -8,7 +8,7 @@ dependencies { api libs.jakartaActivation api libs.commonsLang api(libs.xstream) - api "io.micrometer:micrometer-core:${Deps.micrometerVersion}" + api libs.micrometerCore api libs.springContext api libs.springBootAutoconfigure api libs.slf4jApi diff --git a/services/bonita-scheduler/build.gradle b/services/bonita-scheduler/build.gradle index bf23ca6be3d..9bb82ffc568 100644 --- a/services/bonita-scheduler/build.gradle +++ b/services/bonita-scheduler/build.gradle @@ -7,12 +7,12 @@ dependencies { api project(':services:bonita-commons') api project(':services:bonita-transaction') api project(':services:bonita-incident') - api("org.quartz-scheduler:quartz:${Deps.quartzVersion}") { + api(libs.quartz) { exclude(group: "com.mchange") // c3p0 + transitive dep mchange-commons-java, because we do not use // default Quartz connection provider, as we have our own exclude(module: "HikariCP-java7") // Same reason } - api "io.micrometer:micrometer-core:${Deps.micrometerVersion}" + api libs.micrometerCore testImplementation "junit:junit:${Deps.junit4Version}" testImplementation "org.assertj:assertj-core:${Deps.assertjVersion}" testImplementation "org.mockito:mockito-core:${Deps.mockitoVersion}"