I am relatively new to Ant, and am trying to find the easiest way to WAR-up my web application.
I already have build targets that create the following "exploded WAR" directory structure:
MyApp/
src/
...
gen/ <-- this gets created as a part of every build
war/
stylesheets/
myapp.css
views/
index.jsp
cool.jsp
...
WEB-INF/
web.xml
lib/
(All of my dependencies)
classes/
META-INF/
jdoconfig.xml
com/
myapp/
(All compiled binaries)
So, given the fact that by the time I'm ready to create the WAR file (using <war/>
, <zip/>
or anything else), I already have the exploded version of the WAR ready to go.
The problem I have with the <war/>
task is that it doesn't seem to support directories under war/
besides WEB-INF/lib
and WEB-INF/classes
:
<war destfile="myapp.war" webxml="gen/war/WEB-INF/web.xml">
<lib dir="gen/war/WEB-INF/lib" />
<classes dir="gen/war/WEB-INF/classes" />
</war>
What about stylesheets
and views
, or anything else I might want? What if I want to add a file or directory to WEB-INF/
? What if I wanted to add something to the war at the same level as WEB-INF/
? The <war/>
task just seems to be too inflexible.
Either way (as I'm sure the task is flexible and I'm just not "getting" it), I just want the easiest way to create a myapp.war
with the exact directory structure that the earlier build targets have created under gen/war
. Thanks in advance.