How to list the configured repositories?

前端 未结 3 1232
爱一瞬间的悲伤
爱一瞬间的悲伤 2021-01-01 13:33

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 sour

3条回答
  •  粉色の甜心
    2021-01-01 13:58

    Trying to use Alberto's task from his answer I was getting the following error as in my case I had a Plugin repository defined:

    No such property: url for class: org.gradle.plugin.use.internal.PluginDependencyResolutionServices$PluginArtifactRepository
    

    To avoid this error I have changed the task logic a bit:

    task listrepos {
        doLast {
            println "Repositories:"
            project.repositories.each {
                if (it.name == '__plugin_repository__Gradle Central Plugin Repository') {
                    println "Name: " + it.name + "; url: " + it.url
                } else {
                    println "Name: " + it.displayName
                }
            }
        }
    }
    

提交回复
热议问题