Example of the Ant war task (sample Ant build script)

Ant war task example: Here's another snippet of code from my most recent Ant build scripts. This example code shows how I use the Ant war task to create my war file:

<!-- with all resources in place, create the war file -->
<war destfile="${package.file}" 
     webxml="${temp.dir.web-inf}/web.xml" 
     basedir="${temp.dir}"
     excludes="${lib.dir}/servlet-api.jar">
  <fileset dir="${pages.dir}"/>
  <lib dir="${lib.dir}" />
  <classes dir="${temp.dir.classes}" />
</war>

As with my other examples, I know that I've mixed some variables in here, but I'm hoping the names will be meaningful enough that you'll be able to use this sample code in your own build scripts and Java projects. If it helps to know it, this sample code comes from a working, "real world" project.

Add new comment

The content of this field is kept private and will not be shown publicly.

Anonymous format

  • Allowed HTML tags: <em> <strong> <cite> <code> <ul type> <ol start type> <li> <pre>
  • Lines and paragraphs break automatically.
By submitting this form, you accept the Mollom privacy policy.