Greetings! We’re using the java-platform pattern ...
# dependency-management
j
Greetings! We’re using the java-platform pattern to manage dependency constraints in our mono-repo. So a top level project with many subprojects that have the platform as
implementation(platform(project(':path:to-platform')))
Is there a way, other than enabling
allowDependencies
, to enforce a verison across all subpackages for another project without specifying each one individually? Like take jackson suite of packages or awssdk? Something similar to the bom constraint pattern you can use
implementation(platform('com.fasterxml.jackson:jackson-bom:2.15.2'))
This…fails on compile/invalid -->
api(platform('com.fasterxml.jackson:jackson-bom:2.15.2'))
v
Why do you search for a different than the documented way?
j
My understanding was allow dependencies and setting the dependency as so:
Copy code
dependencies {
    api(platform('com.fasterxml.jackson:jackson-bom:2.15.2'))
}
Would add that dependency to all subprojects that include our project platform. As contrasted with the constraint {} pattern which only constrains the version such that the dependency must be explicitly added in the subproject itself. So we want to avoid this sort of global dependency injection, while constraining the versions of explicitly added packages in that subproject.
v
Not at far as I understand the docs I linked you to. And even then it would only inject the constraints, but even that is not the case, or the docs are misleading. It does exactly what you intend to do.