So I have a project that contains a few subprojects that I am using Gradle with. What I would like to do is copy the resources from subprojectA to the main subprojectB. My structure looks like so.
Application
\subprojectA
\src\main\resources\blah
\subprojectB
\src\main\...
What I want to do, is when my application builds and compiles, overlay the resources folder from subprojectA into the main application's resource folder.
I've tried creating a Gradle task which looks like
task copyExtractorResources(type: Copy) {
from 'extractors/src/main/resources/'
into 'main/build/resources'
}
and while it runs, I can't for the life of me find out how to say "Hey, always do this task before building"
Any help is greatly appreciated.
A simpler way to accomplish this is simply to tell the existing processResources
task to include your additional resources.
processResources {
from 'extractors/src/main/resources'
}
However, for future reference you could implement your original solution by simply adding jar.dependsOn copyExtractorResources
to your build script.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With