Create War using Ant Build File

Creating WAR files with Ant is extremely simple, and very similar to the creating JAR files task. After all, WAR file, like JAR file is just another ZIP file. Here we will show you how to use Ant build script to manage a web application project, create a WAR file and deploy to Tomcat.

The WAR task is an extension to the JAR task.

Attributes for WAR Task-

  • webxml->Path to the web.xml file
  • lib-> A grouping to specify what goes into the WEB-INFlib folder.
  • classes-> A grouping to specify what goes into the WEB-INFclasses folder.
  • metainf-> Specifies the instructions for generating the MANIFEST.MF file.