In looking to write an indexer to generate an index of dependencies for a project, I would like to determine the source URLs for the dependencies in a configuration. For example, given:
apply plugin: 'java'
repositories {
mavenCentral()
}
configurations {
index
}
dependencies {
index 'commons-codec:commons-codec:1.5'
index 'commons-lang:commons-lang:2.6'
}
How can I determine the source URLs, e.g. https://repo1.maven.org/maven2/commons-codec/commons-codec/1.5/commons-codec-1.5.jar, of the dependencies in the configuration?
configurations.index.resolve()
only provides the local file objects from Gradle’s cache. Looking in configurations.index.allDependencies
does not seem to provide any help either.
I know I could assemble a Maven Central URL from the GAV coordinates available from allDependencies
but I would like to support any configured repository and not just Maven Central or maven-like repositories.