File Library Tasks


File Library Tasks

Ants file library tasks enable you to bundles classes and other files into library files such as JARs and WARs.

Jar Task

The jar task creates a Java type Java Application Resource (JAR) file:

 <jar jarfile="[jar]" basedir="[directory]"/> 

Parameters

  • 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.

Nested Parameters

  • fileset: Specifies a collections of files (see section Frequently Used Nested Parameters and Elements at the end of this chapter for more information).

War Task

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> 

Parameters

  • 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.

Nested Parameters

  • 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.

Zip Task

The zip task creates a compressed file library of the Zip type.

 <zip zipfile="[file]"      basedir="[path]" /> 

Parameters

  • 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.

Nested Parameters

  • 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.

Unjar, Unzip, and Unwar Tasks

The unzip task expands file libraries of the Zip type, including WARs and JARs:

<unzip src="[file]" dest="[directory]"/>

Parameters

  • src: The file library to expand.

  • dest: The directory in which to expand the files.




Professional Java Tools for Extreme Programming
Professional Java Tools for Extreme Programming: Ant, XDoclet, JUnit, Cactus, and Maven (Programmer to Programmer)
ISBN: 0764556177
EAN: 2147483647
Year: 2003
Pages: 228

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net