DevOps / Gradle8 Interview Questions
What happens when two dependencies resolve to conflicting versions?
When two dependencies (directly or transitively) require different versions of the same library, Gradle doesn't fail by default — it applies conflict resolution, and by default picks the highest requested version among the candidates, a strategy generally called "latest wins."
configurations.all { resolutionStrategy { failOnVersionConflict() // fail instead of silently picking the highest force 'com.google.guava:guava:33.0.0-jre' // pin a specific version } }
This default keeps most builds working without manual intervention, but it can mask a real incompatibility — if a library genuinely doesn't work with the version Gradle silently selected, the failure shows up later as a runtime NoSuchMethodError or similar, not as a build-time error. resolutionStrategy.failOnVersionConflict() makes Gradle fail loudly at build time instead, forcing an explicit resolution (via force, an exclude, or a version catalog's alignment features) rather than relying on the silent default.
More Related questions...
