Add dependency alignment metadata to Gradle metadata
Opened this issue · 3 comments
Currently, ensuring that versions are aligned between OkHttp dependencies in a Gradle project requires explicitly adding a platform dependency to the okhttp-bom.
Ideally, each module listed in okhttp-bom should itself depend on okhttp-bom as a platform dependency to transitively contribute those dependency constraints downstream.
See https://blog.gradle.org/alignment-with-gradle-module-metadata
That's an interesting approach as opposed to adding each constraint individually.
This came up recently in #8903.
They link to Jackson and Junit. I can't see where Jackson does this because maven.
For junit https://github.com/junit-team/junit-framework/blob/b7eddfc1d953282c2e2cf428a425e047a96b6ebf/junit-jupiter-api/junit-jupiter-api.gradle.kts it's just
api(platform(project(":junit-bom")))
Fwiw, Jackson uses a Maven plugin to publish Gradle Module Metadata : https://github.com/gradlex-org/gradle-module-metadata-maven-plugin
Otherwise yes it's only a matter of adding a platform dependency on the BOM into each module listed in the BOM (creating a form of circular dependency cycle)