I have my project setup so that I have a src/main/resources folder. I’d like to add a single extra file from the root of my project into the project resources. What’s the idiomatic way to do this? This stackoverflow addresses it, http://stackoverflow.com/questions/24207348/add-a-single-file-to-gradle-resources, but it doesn’t have a satisfactory answer.
I’m currently doing something like the following, but it seems very verbose:
sourceSets {
extraResource.resources {
srcDir file("$projectDir")
include 'extra'
}
main.resources {
srcDir 'src/main/resources'
srcDir extraResource.resources
}
}
I’d like to be able to something more like:
sourceSets.main.resources.srcDirs = [ "src/main/resources", file("extra)]
That doesn’t work because a single file isn’t a directory. Something in the middle like:
sourceSets.main.resources {
srcDir "src/main/resources"
srcDir "$projectDir"
include "extra"
}
would be good, but I can’t figure out how to get the include to only apply to a single srcDir. I can include the subdirectory I want as well, but it has a different overall file structure then.
Is there an idiomatic way to do this where I don’t have to introduce a new source set?