Dependency conflict when resolving Gradle build #6
|
I’m running into a dependency conflict in my Gradle project. When I try to build, Gradle fails with a version resolution error. Steps to Reproduce: Clone the repo
Observe dependency resolution error Expected Behavior: Actual Behavior: Environment: Gradle version: 8.5 Java version: 17 OS: macOS 14.3 Additional Context: |
Replies: 1 comment 1 reply
|
This conflict happens because different parts of the project (main vs test dependencies) are pulling in different versions of Guava. To fix it, you can force Gradle to use a single consistent version. In your build.gradle (project-level), add a resolution strategy: Alternatively, you can declare a dependency constraint (Gradle’s recommended way): Then run:
This ensures all configurations (main, test, transitive) resolve to the same Guava version. |
Try this in the root build.gradle:
Or use a dependency constraint in the root:
After that, run:
./gradlew --refresh-dependencies clean buildIf you’re still seeing conflicts, please run:
./gradlew :app:dependencyInsight --configuration runtimeClasspath --dependency guava