Hi
Can you please suggest on a good way to fetch the file of a resolved dependency added to a configuration ?
We tried this :
plugins {
id 'java'
}
configurations { myConfig }
Dependency dep1
Dependency dep2
dependencies {
dep1 = add("myConfig", [group: 'commons-collections', name: 'commons-collections', version: '3.2'])
dep2 = add("myConfig", [group: 'commons-collections', name: 'commons-collections', version: '3.1'])
}
project.tasks.register("fetch") { Task task ->
task.doLast {
Configuration configuration = configurations.myConfig
logger.quiet "dep1 files:\n${configuration.files(dep1).join("\n")}"
logger.quiet "dep2 files:\n${configuration.files(dep2).join("\n")}"
}
}
=========================================================
but when asking for deps2 that was replaced by deps1 (version resolution) we do not get the file of the resolved dependency.
Since we need to copy the file resolved we wanted to know what is the right way after adding a dependency to get its file or the file it was resolved to having in hand only the dependency and the configuration.