Shalom Ben-Zvi Kazaz
03/27/2024, 10:25 PMcom.squareup.retrofit2:retrofit:2.9.0
-- com.squareup.okhttp3:okhttp:3.14.9
now I want to add a direct dependency on com.squareup.okhttp3:logging-interceptor, and i want it to be the same version of okhttp that retrofit brings,3.14.9.
of course i can declare com.squareup.okhttp3:logging-interceptor to the same version, but i want to know if there is a way to do it using some resolution strategy?
so if i declare com.squareup.okhttp3logging interceptor4.12.0 i want to force it to the same version of okhttp 3.14.9.Thomas Broyer
03/28/2024, 8:23 AMcom.squareup.okhttp3
dependencies have the same version (will resolve to the higher version of all dependencies by default though; and I don't think there's a way of downgrading to "the version of the transitive dependency", so declare logging-interceptor with the lowest version to get it upgraded): https://docs.gradle.org/current/userguide/dependency_version_alignment.html#sec:align-versions-unpublishedThomas Broyer
03/28/2024, 8:25 AMShalom Ben-Zvi Kazaz
03/28/2024, 12:09 PMimplementation(enforcedPlatform("com.squareup.okhttp3:okhttp-virtual-platform:3.14.9"))
but still i need to write down the version somewhere which i don't want toThomas Broyer
03/28/2024, 12:13 PMcom.squareup.okhttp3
and not com.squareup.okhttp
)Thomas Broyer
03/28/2024, 12:16 PMimplementation(platform("com.squareup.okhttp3:okhttp-bom:4.12.0"))
(avoid enforcePlatform
if you can, you can keep the component metadata rule to continue aligning even once version 5 is released and possibly brought in transitively)Shalom Ben-Zvi Kazaz
03/28/2024, 12:19 PM