LOHITH KUMAR
08/20/2024, 1:36 PMbuild.gradle files DRY by using the subprojects block in the root project build.gradle. My question is related to dependency management in this setup.
If I specify a dependency (e.g., com.example:library) with version1 in a specific module's build.gradle, but the same dependency is declared with version2 in the subprojects block of the root project`build.gradle`, which version of the dependency will actually be used during the build process?
I want to understand how Gradle resolves such conflicts when a dependency is declared both in a module-specific build.gradle and in the subprojects block with different versions.
Thanks in advance for your help!Vampire
08/20/2024, 1:43 PMsubprojects { ... } or any other means of doing cross-project configuration like e.g. allprojects { ... }, project(...) { ... }, and so on is discouraged bad practice and will work against more sophisticated Gradle optimizations and features.
To DRY, better have a look at convention plugins in buildSrc or an included build, e.g. implemented as precompiled script plugin.LOHITH KUMAR
08/21/2024, 11:23 AM