From 615800270ad4cacb1c123cc2bd4401d43a84e27b Mon Sep 17 00:00:00 2001 From: "emmanuel.duchastenier@bonitasoft.com" Date: Thu, 2 May 2024 11:41:28 +0200 Subject: [PATCH] chore(gradle): convert some libs to version catalog (#2989) * chore(version catalog): convert xstream * chore(version catalog): convert ehcache * chore(version catalog): convert eclipseCompiler * chore(deps): remove unused jbcrypt lib * chore(version catalog): convert jakarta.activation --- bonita-engine/build.gradle | 9 +++-- .../bonita-server-api-http/build.gradle | 2 +- bpm/bonita-client/build.gradle | 2 +- bpm/bonita-web-server/build.gradle | 2 +- buildSrc/src/main/groovy/Deps.groovy | 5 --- gradle/libs.versions.toml | 31 +++++++++++------ .../build.gradle | 2 +- services/bonita-cache/build.gradle | 2 +- services/bonita-commons/build.gradle | 4 +-- services/bonita-identity/build.gradle | 3 +- .../impl/BlowfishCredentialsEncrypter.java | 33 ------------------- services/bonita-persistence/build.gradle | 2 +- 12 files changed, 34 insertions(+), 63 deletions(-) delete mode 100644 services/bonita-identity/src/main/java/org/bonitasoft/engine/identity/impl/BlowfishCredentialsEncrypter.java diff --git a/bonita-engine/build.gradle b/bonita-engine/build.gradle index 29fc1df8831..8176139108d 100644 --- a/bonita-engine/build.gradle +++ b/bonita-engine/build.gradle @@ -16,7 +16,7 @@ dependencyManagement { entry 'slf4j-jdk14' } dependency libs.h2.get() as String - dependency "net.sf.ehcache:ehcache:${Deps.ehcacheVersion}" + dependency libs.ehCache.get() as String dependencySet(group: 'org.springframework', version: libs.versions.springVersion.get()) { entry 'spring-context' @@ -47,14 +47,13 @@ dependencyManagement { entry 'httpclient' entry 'httpmime' } - dependency "com.thoughtworks.xstream:xstream:${Deps.xstreamVersion}" + dependency libs.xstream.get() as String dependency libs.tomcatDbcp.get() as String dependency "org.jboss.narayana.jta:narayana-jta:${Deps.narayanaVersion}" - dependency "com.sun.activation:jakarta.activation:${Deps.activationVersion}" + dependency libs.jakartaActivation.get() as String dependency libs.snakeyaml.get() as String - dependency "org.mindrot:jbcrypt:${Deps.jbcryptVersion}" dependency("org.quartz-scheduler:quartz:${Deps.quartzVersion}") - dependency "org.eclipse.jdt:ecj:${Deps.eclipseCompilerVersion}" + dependency(libs.eclipseCompiler.get() as String) dependency("javax.annotation:javax.annotation-api:$Deps.javaxAnnotationsVersion") dependencySet(group: "io.micrometer", version: Deps.micrometerVersion) { entry "micrometer-core" diff --git a/bpm/bonita-api/bonita-server-api-http/build.gradle b/bpm/bonita-api/bonita-server-api-http/build.gradle index abbe1fbeeef..cc59afac8d7 100644 --- a/bpm/bonita-api/bonita-server-api-http/build.gradle +++ b/bpm/bonita-api/bonita-server-api-http/build.gradle @@ -4,7 +4,7 @@ dependencies { api project(':services:bonita-platform-session') api project(':services:bonita-session') api project(':bpm:bonita-common') - api "com.thoughtworks.xstream:xstream:${Deps.xstreamVersion}" + api libs.xstream api libs.commonsFileUpload api libs.commonsIO testImplementation libs.springTest diff --git a/bpm/bonita-client/build.gradle b/bpm/bonita-client/build.gradle index c0d879d4b33..3ab9e4eaa9c 100644 --- a/bpm/bonita-client/build.gradle +++ b/bpm/bonita-client/build.gradle @@ -8,7 +8,7 @@ plugins { dependencies { api project(':bpm:bonita-common') api libs.httpComponentsClient - api "com.thoughtworks.xstream:xstream:${Deps.xstreamVersion}" + api libs.xstream api libs.httpComponentsMime testImplementation "junit:junit:${Deps.junit4Version}" testImplementation "org.assertj:assertj-core:${Deps.assertjVersion}" diff --git a/bpm/bonita-web-server/build.gradle b/bpm/bonita-web-server/build.gradle index 3cad3b2ab71..dcf35c7a616 100644 --- a/bpm/bonita-web-server/build.gradle +++ b/bpm/bonita-web-server/build.gradle @@ -12,7 +12,7 @@ dependencies { implementation(project(":bpm:bonita-web-extensions")) implementation libs.commonsIO implementation libs.slf4jApi - implementation "net.sf.ehcache:ehcache:${Deps.ehcacheVersion}" + implementation libs.ehCache implementation libs.commonsFileUpload implementation libs.commonsBeanUtils implementation libs.commonsCollections diff --git a/buildSrc/src/main/groovy/Deps.groovy b/buildSrc/src/main/groovy/Deps.groovy index 0f245b59e0d..d4d72c6b4d6 100644 --- a/buildSrc/src/main/groovy/Deps.groovy +++ b/buildSrc/src/main/groovy/Deps.groovy @@ -1,10 +1,5 @@ class Deps { - public static String xstreamVersion = "1.4.20" - public static String ehcacheVersion = "2.10.10.12.7" - public static String eclipseCompilerVersion = "3.20.0" - public static String jbcryptVersion = "0.4" - public static String activationVersion = "1.2.2" public static String quartzVersion = "2.3.2" public static String micrometerVersion = "1.6.1" diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 977bcb0a8b0..90f2a6f0081 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -25,6 +25,10 @@ jakartaServletVersion = "4.0.4" # Keep this until all client projects have migrated to jakarta or it will break their builds ! javaxServletVersion = "4.0.1" httpComponentsVersion = "4.5.13" +xstreamVersion = "1.4.20" +ehCacheVersion = "2.10.10.12.7" +eclipseCompilerVersion = "3.20.0" +jakartaActivationVersion = "1.2.2" [libraries] springCore = { module = "org.springframework:spring-core", version.ref = "springVersion" } @@ -63,16 +67,16 @@ groovyYaml = { module = "org.codehaus.groovy:groovy-yaml", version.ref = "groovy bonitaArtifactsModelBom = { module = "org.bonitasoft.engine:bonita-artifacts-model-dependencies", version.ref = "bonitaArtifactsModelVersion" } -bonitaCommonArtifactsModel = { module = "org.bonitasoft.engine:bonita-common-artifacts-model", version.ref = "bonitaArtifactsModelVersion" } -bonitaBusinessArchiveModel = { module = "org.bonitasoft.engine:bonita-business-archive", version.ref = "bonitaArtifactsModelVersion" } -bonitaProcessDefinitionModel = { module = "org.bonitasoft.engine:bonita-process-definition-model", version.ref = "bonitaArtifactsModelVersion" } -bonitaFormMappingModel = { module = "org.bonitasoft.engine:bonita-form-mapping-model", version.ref = "bonitaArtifactsModelVersion" } -bonitaBusinessObjectModel = { module = "org.bonitasoft.engine:bonita-business-object-model", version.ref = "bonitaArtifactsModelVersion" } -bonitaBdmAccessControlModel = { module = "org.bonitasoft.engine:bonita-bdm-access-control-model", version.ref = "bonitaArtifactsModelVersion" } -bonitaProfileModel = { module = "org.bonitasoft.engine:bonita-profile-model", version.ref = "bonitaArtifactsModelVersion" } -bonitaOrganizationModel = { module = "org.bonitasoft.engine:bonita-organization-model", version.ref = "bonitaArtifactsModelVersion" } -bonitaApplicationModel = { module = "org.bonitasoft.engine:bonita-application-model", version.ref = "bonitaArtifactsModelVersion" } -bonitaConnectorModel = { module = "org.bonitasoft.engine:bonita-connector-model", version.ref = "bonitaArtifactsModelVersion" } +bonitaCommonArtifactsModel = { module = "org.bonitasoft.engine:bonita-common-artifacts-model", version.ref = "bonitaArtifactsModelVersion" } +bonitaBusinessArchiveModel = { module = "org.bonitasoft.engine:bonita-business-archive", version.ref = "bonitaArtifactsModelVersion" } +bonitaProcessDefinitionModel = { module = "org.bonitasoft.engine:bonita-process-definition-model", version.ref = "bonitaArtifactsModelVersion" } +bonitaFormMappingModel = { module = "org.bonitasoft.engine:bonita-form-mapping-model", version.ref = "bonitaArtifactsModelVersion" } +bonitaBusinessObjectModel = { module = "org.bonitasoft.engine:bonita-business-object-model", version.ref = "bonitaArtifactsModelVersion" } +bonitaBdmAccessControlModel = { module = "org.bonitasoft.engine:bonita-bdm-access-control-model", version.ref = "bonitaArtifactsModelVersion" } +bonitaProfileModel = { module = "org.bonitasoft.engine:bonita-profile-model", version.ref = "bonitaArtifactsModelVersion" } +bonitaOrganizationModel = { module = "org.bonitasoft.engine:bonita-organization-model", version.ref = "bonitaArtifactsModelVersion" } +bonitaApplicationModel = { module = "org.bonitasoft.engine:bonita-application-model", version.ref = "bonitaArtifactsModelVersion" } +bonitaConnectorModel = { module = "org.bonitasoft.engine:bonita-connector-model", version.ref = "bonitaArtifactsModelVersion" } commonsLang = { group = "org.apache.commons", name = "commons-lang3", version.ref = "commonsLangVersion" } snakeyaml = "org.yaml:snakeyaml:1.32" @@ -98,6 +102,13 @@ javaxServletApi = { group = "javax.servlet", name = "javax.servlet-api", version httpComponentsClient = { group = "org.apache.httpcomponents", name = "httpclient", version.ref = "httpComponentsVersion" } httpComponentsMime = { group = "org.apache.httpcomponents", name = "httpmime", version.ref = "httpComponentsVersion" } +xstream = { group = "com.thoughtworks.xstream", name = "xstream", version.ref = "xstreamVersion" } +ehCache = { group = "net.sf.ehcache", name = "ehcache", version.ref = "ehCacheVersion" } +eclipseCompiler = { group = "org.eclipse.jdt", name = "ecj", version.ref = "eclipseCompilerVersion" } +jakartaActivation = { group = "com.sun.activation", name = "jakarta.activation", version.ref = "jakartaActivationVersion" } + + + h2 = "com.h2database:h2:1.4.199" lombok = "org.projectlombok:lombok:1.18.30" diff --git a/services/bonita-business-data/bonita-business-data-generator/build.gradle b/services/bonita-business-data/bonita-business-data-generator/build.gradle index 55b0f98d847..7d186388bc4 100644 --- a/services/bonita-business-data/bonita-business-data-generator/build.gradle +++ b/services/bonita-business-data/bonita-business-data-generator/build.gradle @@ -8,7 +8,7 @@ plugins { dependencies { api project(':services:bonita-commons') api libs.hibernateCore - api "org.eclipse.jdt:ecj:${Deps.eclipseCompilerVersion}" + api(libs.eclipseCompiler) api libs.springCore api libs.javassist api project(':bpm:bonita-common') diff --git a/services/bonita-cache/build.gradle b/services/bonita-cache/build.gradle index 51c46eeb409..481ba21e13f 100644 --- a/services/bonita-cache/build.gradle +++ b/services/bonita-cache/build.gradle @@ -1,7 +1,7 @@ dependencies { - api "net.sf.ehcache:ehcache:${Deps.ehcacheVersion}" + api libs.ehCache api project(':services:bonita-commons') api project(':services:bonita-session') api libs.springContext diff --git a/services/bonita-commons/build.gradle b/services/bonita-commons/build.gradle index 573c8626b95..69e660f2a78 100644 --- a/services/bonita-commons/build.gradle +++ b/services/bonita-commons/build.gradle @@ -5,9 +5,9 @@ dependencies { exclude(module: 'commons-collections') } api libs.commonsIO - api "com.sun.activation:jakarta.activation:${Deps.activationVersion}" + api libs.jakartaActivation api libs.commonsLang - api(group: 'com.thoughtworks.xstream', name: 'xstream', version: Deps.xstreamVersion) + api(libs.xstream) api "io.micrometer:micrometer-core:${Deps.micrometerVersion}" api libs.springContext api libs.springBootAutoconfigure diff --git a/services/bonita-identity/build.gradle b/services/bonita-identity/build.gradle index 1c62b14a9bd..c76d0b8b8bc 100644 --- a/services/bonita-identity/build.gradle +++ b/services/bonita-identity/build.gradle @@ -7,8 +7,7 @@ dependencies { api project(':services:bonita-persistence') api project(':services:bonita-commons') api project(':services:bonita-events') - api "org.mindrot:jbcrypt:${Deps.jbcryptVersion}" - api "com.sun.activation:jakarta.activation:${Deps.activationVersion}" + api libs.jakartaActivation testImplementation "junit:junit:${Deps.junit4Version}" testImplementation "org.mockito:mockito-core:${Deps.mockitoVersion}" testImplementation "org.assertj:assertj-core:${Deps.assertjVersion}" diff --git a/services/bonita-identity/src/main/java/org/bonitasoft/engine/identity/impl/BlowfishCredentialsEncrypter.java b/services/bonita-identity/src/main/java/org/bonitasoft/engine/identity/impl/BlowfishCredentialsEncrypter.java deleted file mode 100644 index 81f1d3261ea..00000000000 --- a/services/bonita-identity/src/main/java/org/bonitasoft/engine/identity/impl/BlowfishCredentialsEncrypter.java +++ /dev/null @@ -1,33 +0,0 @@ -/** - * Copyright (C) 2019 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.identity.impl; - -import org.mindrot.jbcrypt.BCrypt; - -/** - * @author Matthieu Chaffotte - */ -public class BlowfishCredentialsEncrypter implements CredentialsEncrypter { - - @Override - public String hash(final String password) { - return BCrypt.hashpw(password, BCrypt.gensalt(16)); - } - - @Override - public boolean check(final String password, final String hashPassword) { - return BCrypt.checkpw(password, hashPassword); - } - -} diff --git a/services/bonita-persistence/build.gradle b/services/bonita-persistence/build.gradle index c10b74e1f5b..ddc068feb65 100644 --- a/services/bonita-persistence/build.gradle +++ b/services/bonita-persistence/build.gradle @@ -9,7 +9,7 @@ dependencies { exclude(module: "jboss-transaction-api_1.2_spec") exclude(group: "javax.activation") //replaced by jakarta } - api "com.sun.activation:jakarta.activation:${Deps.activationVersion}" + api libs.jakartaActivation api project(':services:bonita-session') api project(':services:bonita-commons') api project(':services:bonita-lock')