How to list the configured repositories?
If someone comes to this page looking for the Kotlin (build.gradle.kts) equivalent of @Alberto's answer, it would be done as follows:
tasks.register("listrepos") {
doLast {
println("Repositories:")
project.repositories.map{it as MavenArtifactRepository}
.forEach{
println("Name: ${it.name}; url: ${it.url}")
}
}
}
Just as a heads up, the cast to a MavenArtifactRepository
is required in the Kotlin version to get the url
property. This could be different for you if you are not adding Maven Repositories.
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à...