83
Apache Ant War Task
Ant WAR (Web Archive) is an extension of Java Archive file. It is consist of library, classes etc and store into WEB-INF/lib, WEB-INF/classes folders.
Apache Ant WAR Attributes
Attribute | Description | Required |
---|---|---|
destfile | Name of the WAR to create. | Yes |
webxml | Servlet configuration descriptor | Yes |
basedir | Directory from which to jar the files. | No |
compress | Store and compress data | |
encoding | It is used to specify encoding. | No |
filesonly | Stores only files | No |
includes | Include a list of files. | No |
excludes | Excludes a list of files. | No |
update | Update destination file even when present. | No |
Apache Ant WAR Task Nested Elements
lib
This element specifies a fileset. All the files are located in WEB-INF/lib folder of the created WAR.
classes
This element specifies a fileset of class files. After creating war, all the classes are located into WEB-INF/classes folder.
webinf
This nested element specifies a fileset. All the files are located into WEB-INF directory.
Apache Ant War Task Example
The above code will create a myapp.war file which has a file structure given below. The above code will create a myapp.war file which has a file structure given below.
Next TopicApache Ant Zip Task