Slackbot
04/07/2022, 2:27 AMM3
04/07/2022, 2:30 AMid 'io.spring.dependency-management'
Danny Thomas
04/07/2022, 2:40 AMM3
04/07/2022, 5:10 AMVampire
04/07/2022, 7:57 AMplatform(...)
.
If it is not about consuming an existing BOM from another project, there might be better ways. If you just want a central catalog of versions for your project, use a version catalog. If you want to project in your build like a BOM module in Maven, that influences dependency resolution, including transitive dependencies, define a platform (if you publish that, it comes out as BOM for Maven consumers and with better metadata for Gradle consumers. If you want the versions of all projects in a build always aligned at consumer, use a platform that depends on the individual projects and make the projects also depend on the platform, ...
It's all in the docs too. 🙂M3
04/07/2022, 4:01 PMplatform()
stuff to see if that can do the sameVampire
04/07/2022, 4:51 PMenforcedPlatform()
, but that should usually not be used, but only in edge cases, and never in a library project.Anze Sodja
04/07/2022, 4:52 PMdependencyManagement
block from Maven or Spring dependency plugin. To always use some version strictly, you would use:
dependencies {
constraints {
// or with a !! shortcut: implementation("org.apache.httpcomponents:httpclient:4.5.3!!")
implementation("org.apache.httpcomponents:httpclient") {
version {
strictly("4.5.3")
}
}
}
}
I think the main difference with Maven would be how pom
is handled. With Gradle you set just the pom’s version in constraints, but if you want for a pom to actually affect other dependencies, you add it to dependencies
block as a platform
.
While in Maven pom will affect other dependencies as soon as you add it to the dependencyManagement
block.Vampire
04/07/2022, 4:57 PMVampire
04/07/2022, 4:58 PMplatform
and enforcedPlatform
do, is exactly adding those constraints, just in a bunch from a BOM or Gradle Platform, isn't it?Anze Sodja
04/07/2022, 5:04 PMconstraints {}
block as an direct alternative to a Maven’s dependencyManagement
and you want to translate dependencyManagement
block from your Maven project to Gradle constraints
, there is a difference I believeVampire
04/07/2022, 5:14 PM