If I want to apply a bom to all of my projects ("c...
# community-support
s
If I want to apply a bom to all of my projects ("com.squareup.okhttp3:okhttp-bom") is there a way to do it in one place so that I don't have to write
implementation(platform(libs.okhttp.bom))
in all places where I add any okhttp dependency? Conceptually, something like
Copy code
subprojects {
    dependencies {
        implementation(platform(libs.okhttp...
but I can't seem to find the proper way to do this.
m
Probably the answer is convention plugins
s
So I just put
implementation(platform(libs.ok
as a common configuration to my convention plugin which I have hopefully applied to all of my projects already, right?
m
yup
Your snippet should actually work if you exclude project isolation I think?
s
implementation
does not seem to resolve there if I am seeing correctly. I just wrote it as pseudocode to convey what I wanted to be done 😄
m
That's because there's no generated accessors there but you can always use the String syntax:
Copy code
subprojects {
    dependencies {
        add("implementation", platform(libs.okhttp...))
It's all
String
under the hood
If you're using precompiled script plugins you'll have the generated accessors in your convention plugins but IMO the
String
code is just easier and faster
v
But you really should not do cross-project configuration like that. That's highly discouraged and also works against other optimizations and features, not only project isolation.
Actually, the best option would be to convince okhttp to publish proper version alignment metadata, then you don't need to manually apply the BOM
t
💯 1
👌 1