Align versions of modules using a published BOM
what’s the different of using the complex way belongsTo and the simple way import
abstract class JacksonBomAlignmentRule implements ComponentMetadataRule {
void execute(ComponentMetadataContext ctx) {
ctx.details.with {
if (id.group.startsWith("com.fasterxml.jackson")) {
// declare that Jackson modules belong to the platform defined by the Jackson BOM
belongsTo("com.fasterxml.jackson:jackson-bom:${id.version}", false)
}
}
}
}
dependencies {
components.all(JacksonBomAlignmentRule)
}
dependencies {
api(platform("com.fasterxml.jackson:jackson-bom:${id.version}"))
}