Presents your JAVA E-NEWSLETTER for September 16, 2002 <-------------------------------------------> DEPLOY RESOURCES WITH WAR FILES You can use a Web Application Archive (WAR) file created from an Ant build script to deploy Java code to a server. A Web application in Java has a certain format located within a special directory named WEB-INF. This directory contains a lib directory for jars, a classes directory for unpackaged class files, and a web.xml file describing the application. The rest of the Web application is just normal HTML, JSP, images, and directories. These can be zipped up into a .war file and then deployed to a server without having to make any modification to the server. Most important, the server will notice when the .war file is placed in the webapps/directory and automatically unpack it and add it to the server without changes to the server.xml file. Deploying a change is a simple matter of overwriting the .war file with a new one. The server will notice again, unpack it, and reload all class files. The Ant war task is an extension of the jar task with some special handling for the WEB-INF directory, which may have four subtags: lib, classes, webinf, and metainf. Files specified in these tags will go into their particular directories, while metainf will go into the META-INF directory. Here's an example of the war task: This example will build a file named ApplicationVersion2.war. It gets its web.xml file from xml/av2-web.xml and includes every file in the HTML directory. Additionally, it puts all the files in our lib/ext directory into the war's WEB-INF/lib directory, except for the Oracle ones, and puts all servlets sitting in the build/servlets directory into the WEB-INF/classes directory. ----------------------------------------