As part of our gradle build we launch a webapp runner (tomcat), that executes against an exploded war. I would like to create a task that infintely calls a Copy task to update the resources in the deployed/exploded war with whatever is in a set of project’s web-app directories.
I tried something like :
task copyUI(type: Copy) {
into "${buildDir}/exploded"
from "${project(':someproject').projectDir}/src/main/webapp"
}
task copyUIRepeat() << {
while (true){
println "copying UI"
tasks.copyUI.execute()
}
}
but I get ‘The task artifact state cache {foo} has not been locked.’
I see I’m not supposed to call execute, but I’m not sure how else to accomplish this sort of behavior. Suggestions?
Thanks guys, I’m going with Project.copy as that seems to work fine for the most part.
Here’s one thing I’ve noticed that’s kind of unrelated but I might as well mention here as I’m not sure it warrants much discussion:
In the scenario I’ve described I initially have one gradle task running that never completes (running the web-app via an exec task). I can run a second task concurrently (my continuously up-to-date sync task), but if I change the build.gradle file and try to run the sync task it locks and will not proceed. Edge case I guess.