Reputation: 10419
How do I specify multiple dirs for the same fileTree in gradle. Is this possible?
Say I have
def files = fileTree(
dir: "src/test/groovy")
}
and I want to also add in another folder?
Reason I ask is, I want to reference multiple folders and files in this construct, not just the one fileTree
task testLibraryJar(type: Jar, dependsOn: classes) {
classifier = 'testlib'
from files
}
Thanks
Upvotes: 0
Views: 1169
Reputation: 142
I would use an array of fileTree objects to give multiple directories to your testLibraryJar task.
def allTrees = [
fileTree(dir: "src/test/groovy"),
fileTree(dir: "/tmp")
]
task testLibraryJar(type: Jar, dependsOn: classes) {
classifier = 'testlib'
from allTrees
}
Upvotes: 1