Reputation: 2291
I have a java gradle application. And I have a task:
task copyDependenciesNoSr(type: Copy) {
from configurations.compile into 'build/libs/nosr/lib'
}
But, I need to copy only certain libs from there in one task, and other set of libs in another task. How to filter it? I have over 50 dependencies libs, and I can't do 50 one-line-copy tasks and one big task for them. How to specify a list of jars from compile set to copy to folder?
Upvotes: 1
Views: 867
Reputation: 154
This should be able to help you out:
task copyDependenciesNoSr(type: Copy) {
from (configurations.compile){
include 'a','b'
exclude 'x','y'
}
into 'build/libs/nosr/lib'
}
The commands also take patterns if you can specify any, in that case you won't have to specify the entire list.
For more information, look into https://docs.gradle.org/current/dsl/org.gradle.api.tasks.Copy.html
Upvotes: 2