[FIXED] Which dependency will Gradle choose given multiple maven repository?


In Gradle project, we can define multiple remote / local Maven repository.

buildscript {
    repositories {
        maven { 
            url 'https://example1.mavenrepo.com/public'
        maven {
            url "https://example2.mavenrepo.com/release"

    dependencies {
        classpath 'com.example.mydependencies:mylibrary:1.0.0'

If mylibrary exist in all of Maven repo. Which one will Gradle choose? Can I configure Gradle to only download mylibrary in certain Maven repo?


As you can find in the doc

A project can have multiple repositories. Gradle will look for a dependency in each repository in the order they are specified, stopping at the first repository that contains the requested module.

Answered By – Gabriele Mariotti

Answer Checked By – Marie Seifert (Easybugfix Admin)

Leave a Reply

(*) Required, Your email will not be published