Skip to content

Instantly share code, notes, and snippets.

@uarun
Created December 25, 2012 20:19
Show Gist options
  • Save uarun/4375219 to your computer and use it in GitHub Desktop.
Save uarun/4375219 to your computer and use it in GitHub Desktop.
Resolving version conflicts in Gradle

Resolving Version Conflicts in Gradle

If one module has a dependency on version 1.1 of library X and another module on version 2.0 of the same library, gradle will use the latest version.

Failing a build on version conflict

To make gradle fail the build on encountering a conflict, we can do the following:

configurations.all {
    resolutionStrategy {
        failOnVersionConflict()
    }
}

Forcing a certain version

To force a certain version number for all dependencies:

configurations.compile {
    resolutionStrategy {
        force 'groupId:artifactId:desiredVersion'
    }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment