What makes it worse is that it does not even seem possible to override the outputs of the copy task with the files being copied. In my case, even with something like
task unzipDependencies(type: Copy) {
into '.'
FileTree output
configurations.compile.resolvedConfiguration.resolvedArtifacts.each { artifact ->
if (artifact.file.name.endsWith('.zip')) {
FileTree contents = zipTree(artifact.file)
from contents
if (output == null) {
output = contents
} else {
output += contents
}
}
}
outputs.files output
}
cleanUnzipDependencies would still delete everything under ‘.’.