I have some test data with some special content (images, videos, etc.) in my Grails 2 application that should not be included when building the war. At development time, these files are stored in web-app/content/. So the question is, how do I exclude them when build a war for the production environment?
During my search I came accross this blog post, covering the topic in an earlier Grails version. Unfortunately it doesn’t seem to work anymore and the comments didn’t help me either.
This is what I have tried for now:
grails.war.resources = { stagingDir ->
delete { fileset(dir: "${stagingDir}/content/", includes: '*') }
}
Maybe I am just missing something? Or is there even a better way to separate test-data from shipping the application?
Yeah, I was obviously missing something. Or to be more precise sometimes less information is more. After a bit more of googling for
ant delete filesetI saw that theincludesattribute is deprecated. After leaving it out, all files in thecontentdirectory were removed. Even the directory structure is still present, which is exactly what I wanted.So my solution for now is:
EDIT:
As far as I know grails uses ant under the hood, so the Ant Delete Task is the thing to look at. So I guess if you want to delete the empty subdirectories too, it would be (not checked though):
or if u want to delete the
contentfolder itself just: