I need to copy dependencies of a number of configurations based on their name: here I want to select all configurations with name that starts with “gretty”. I tried this:
task exportGrettyLibs {
doLast {
copy {
from configurations.findAll {
config -> config.getName().startsWith(“gretty”)
}
into "$buildDir/output/libGretty"
include ‘**/*.jar’
}
}
}

but it copies dependencies for all configurations in the project. Any suggestions?

Another thought, are you sure you’re not seeing jars that were copied from one of your previous runs? Your exportGrettyLibs task does not clear the output directory and the copy method does not do that for you.