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

(adam.fitzgerald) #1

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

configurations.myconfig.each { File f ->

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: 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

(thomas.glaeser) #2

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.

(Adam Murdoch) #3

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

(thomas.glaeser) #4

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

(adam.fitzgerald) #5

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.