How to list the configured repositories?

Alberto picture Alberto · Aug 21, 2015 · Viewed 9.8k times · Source

How can I list all the repositories configured for a project?

Background: I have a pretty complex gradle build script and cannot get my NetBeans to download the sources for maven dependencies. In that issue-report I was suggested to double check the order in which mavenCentral is being imported.

Answer

Alberto picture Alberto · Aug 21, 2015

For anyone interested, here is the code to list the loaded repositories (thanks @kelemen):

task listrepos {
    doLast {
        println "Repositories:"
        project.repositories.each { println "Name: " + it.name + "; url: " + it.url }
   }
}

After adding this code to the build script, execute gradle listrepos and voilà...