Hello,
I recently upgraded a Gradle project from version 4.2 to 8.1.1. This was done in step-by-step manner, upgrading subsequently from one major version to the next(i.e., 4 → 5, 5 → 6, etc.), ensuring the project remained building successfully at each iteration.
Moving from Gradle 6 to 7, I noticed the following change in explicit dependency requirements:
Before the upgrade - Implicit dependency supported
MyProject is a gradle project with subprojects A, B, and C:
subproject B: declare dependency on A
*myProject/B/build.gradle*
dependencies {
compile(project(":A"))
}
subproject C: declare dependency on B
*myProject/C/build.gradle*
dependencies {
compile(project(":B"))
}
As a result of the above it is observed that C will have dependency on A automatically without having to explicitly state it in C’s build script.
After the upgrade - Implicit dependency no longer appears supported
subproject B: declare dependency on A
*myProject/B/build.gradle*
dependencies {
implementation(project(":A"))
}
subproject C: declare dependency on B
But also it is observed that C must explicitly declare dependency on A for the build to not fail
*myProject/C/build.gradle*
dependencies {
implementation(project(":B"))
implementation(project(":A"))
}
Looking through the Gradle docs I was unable to find any information in support of this now being a requirement in the more recent versions of Gradle. Is this behaviour expected, and if so what is the reasoning behind it?
Thank you!