Re-Reading the quoted answer in groovy I just realized my mistake. The configuration has to be declared as not beeing transitive.
val myExtraDependencyby configurations.creating {
setTransitive(false) // <-- This was missing
}
dependencies {
myExtraDependency("com.acme:somedependency:1.0.0")
}
val unzipMyExtraDependency by tasks.creating(Copy::class) {
group = "unzip"
from(zipTree(myExtraDependency.singleFile))
include("/interesting_files/**")
into("$projectDir/build/tmp/")
}