An Ant build script for web applications

Sure, here's a sample Ant build script for a Java web application. I've included other example Ant scripts for Java Swing/JFC/GUI applications on this website, but this one demonstrates how to use Ant to build a web app instead.

Ant web build script - Discussion

In this sample Ant web build script I also do a fair amount of variable substitution during the build process. I do this by referencing a property file in this line of the Ant script:

<property file="build.${currentenv.ANT_HOST_NAME}" />

This lets me change Ant build properties depending on which server (or workstation) I am running the build process on. The ANT_HOST_NAME is a variable that I set in the environment of each machine. Here are the contents of one of these property file that I reference on my laptop: