How can I get the origin URI of each of the artifacts in a given configuration

I am currently constructing a classpath for use with a generated shell script via something like the following:

configurations.myconfig.each { File f ->
   paths.add(f.canonicalPath)
}

This works for me currently because the files returned via this method are the original locations of the artifacts as resolved by ivy, uncached because they are coming from the filesystem resolver.

I’d like to also apply the workaround described here: http://issues.gradle.org/browse/GRADLE-1964 to enable caching, as it appreciably speeds our build process. This of course means that the files are referring to the locations in the cache.

Is there a way to iterate through the resolved artifacts and extract the location they were downloaded from?

Thanks, Adam

I wonder if this discussion could be moved under the Ideas queue. Such a feature would come handy in several scenarios, e.g. considering the case where external modules licensed for redistribution are resolved from a repository named ‘ext-redist-release’ while the once used for testing only come from ‘ext-noredist-release’. When assembling your products one would need to ensure that none of the modules from ‘ext-noredist-release’ gets included.

I’m curious, why can’t you just use the path of the file in the cache in your generated script?

There is exactly one artifact cache location, but the artifacts resolved might come from different logical repositories. Does this make sense?

For our use case the scripts we are generated are publishable artifacts. The cache locations may be specific to a particular user or machine, whereas the original location can be relied upon to be accessible by any of the potential consumers of the published script.