Hello everyone,
I have a project which provides a version-catalog and is consumable via an artifact.
In the version-catalog there is a libs.versions.toml
, which is defined in its build.gradle
:
catalog {
versionCatalog {
from(files("./gradle/libs.versions.toml"))
}
}
The consumers of this catalog define in the settings.gradle
:
dependencyResolutionManagement {
versionCatalogs {
create("libs") {
from("group:version-catalog:1.0")
}
}
}
And use the dependencies like:
plugins {
alias(libs.plugins.springDependencyManagement)
}
dependencies {
implementation(libs.mapstruct)
}
Unfortunately, I now have dependencies which import old dependencies and I want to enforce certain versions.
I would actually do it like this:
configurations.configureEach {
resolutionStrategy {
forcedModules = [
'org.springframework:spring-webmvc:6.1.3',
'ch.qos.logback:logback-core:1.4.14',
'ch.qos.logback:logback-classic:1.4.14'
]
}
}
If I define this configuration in the projects that also consume the catalog, it works.
However, if I define this configuration in the version catalog, it does not work for the consumers of the catalog.
Is there any way to define this in the catalog without having to duplicate this config in every project? I seem to be overlooking some configuration/possibility.
Thank you very much for your help!