Ants file library tasks enable you to bundles classes and other files into library files such as JARs and WARs.
The jar task creates a Java type Java Application Resource (JAR) file:
<jar jarfile="[jar]" basedir="[directory]"/>
jarfile*: Name of the JAR file to create.
basedir: The directory from which to recursively make the JAR.
compress: Boolean value of true or false. When set to false, compression wont be used. Defaults to true.
includes: Comma-separated list of patterns to use with a basedir parameter.
includesfile: File in which each new line lists patterns to use with a basedir parameter.
excludes: Comma-separated list of patterns not to use with a basedir parameter.
excludesfile: File in which each new line lists patterns not to use with a basedir parameter.
defaultexcludes: A value of yes or no. Yes sets the default excludes to be used. Defaults to no.
manifest: The name of the manifest file to use.
whenempty: If set to skip, the JAR file is not made if no files match the pattern. Defaults not to skip.
fileset: Specifies a collections of files (see section Frequently Used Nested Parameters and Elements at the end of this chapter for more information).
The war task creates a Java type Web Application Resource (WAR) file.
<war warfile="[file name]" webxml="[file name]"> <fileset dir="[path]"/> <lib dir="[path]"> </lib> <classes dir="[path]"/> </war>
warfile: The name of the WAR (Web Application Resource) file the task will create.
webxml: The web.xml file to be used as a deployment descriptor for the WAR file.
basedir: The directory that contains the files to put into the Zip. Defaults to the base directory defined in the project.
compress: Boolean value of true or false. When set to false, the files will not be compressed in the Zip. Defaults to true.
includes: Comma-separated list of patterns to use with a directory parameter.
includesfile: File in which each new line lists patterns to use with a directory parameter.
excludes: Comma-separated list of patterns not to use with a directory parameter.
excludesfile: File in which each new line lists patterns not to use with a directory parameter.
defaultexcludes: When set to yes, default excludes are to be used. Defaults to no.
manifest: A manifest to use in the WAR file.
whenempty: If set to skip, the Zip is not made when no files match the pattern. Defaults to not skip.
lib: Specifies files to go in the WEB-INF/LIB directory of the WAR. All files in the LIB directory will be available when the Web application runs.
fileset: Specifies a collections of files (see section Frequently Used Nested Parameters and Elements at the end of this chapter for more information).
classes: Specifies files to go in the WEB-INF/CLASES directory of the WAR. All files in the CLASSES directory are the compiled source of the Web application.
fileset: Specifies a collections of files (see section Frequently Used Nested Parameters and Elements at the end of this chapter for more information).
webinf: Specifies files to go in the WEB-INF directory of the WAR.
fileset: Specifies a collections of files (see section Frequently Used Nested Parameters and Elements at the end of this chapter for more information).
zipfileset: See section Frequently Used Nested Parameters and Elements at the end of this chapter for a definition.
The zip task creates a compressed file library of the Zip type.
<zip zipfile="[file]" basedir="[path]" />
zipfile*: The name of the Zip file the task will create.
basedir: The directory that contains the files to put into the Zip. Defaults to the base directory defined in the project.
compress: When set to false, the files will not be compressed in the Zip. Defaults to true.
includes: Comma-separated list of patterns to use with a directory parameter.
includesfile: File in which each new line lists patterns to use with a directory parameter.
excludes: Comma-separated list of patterns not to use with a directory parameter.
excludesfile: File in which each new line lists patterns not to use with a directory parameter.
defaultexcludes: When set to yes, default excludes are to be used. Defaults to no.
whenempty: If set to skip, the Zip file is not made if no files match the pattern. Defaults not to skip.
fileset: Specifies a collections of files (see section Frequently Used Nested Parameters and Elements at the end of this chapter for more information).
zipfileset: See section Frequently Used Nested Parameters and Elements at the end of this chapter for definition.
The unzip task expands file libraries of the Zip type, including WARs and JARs:
<unzip src="[file]" dest="[directory]"/>
src: The file library to expand.
dest: The directory in which to expand the files.