Ant defines a special task for building Web Archive (WAR) files. The war task defines two special file sets for classes and library JAR files: classes and lib, respectively. Any other file set would be added to the document root of the WAR file (see Chapter 6 for more information).
Listing 20.8 uses the war task with three file sets. The war task will put the files specified by the fileset into the document root. As you can see in Listing 20.8, one file set includes the helloapplet.jar file, and the other two file sets contain all the files in the HTML and JSP directories. All three file sets will end up in the docroot of the Web application archive.
The war task body also specifies where Tomcat should locate the classes using the file set called classes<war warfile="${dist}/hello.war" webxml="${meta}/web.xml"> <!-
Include the html and jsp files.
Put the classes from the build into the classes
directory of the war.
/-->
<fileset dir="./HTML" />
<fileset dir="./JSP" />
<!-- Include the applet. /-->
<fileset dir="${lib}" includes="helloapplet.jar" />
/-->
<lib dir="${lib}" >
<exclude name="greet-ejbs.jar"/>
<exclude name="helloapplet.jar"/>
Listing 20.8