Overview of Ant core tasks

Given the large number of tasks available to a build designer, it may be difficult to get an overall view of what each task can do. The following table provides a short description of each task and a link to the complete documentation.

Task Name Description
Ant

Runs Ant on a supplied buildfile. This can be used to build subprojects.

AntCall

Call another target within the same build-file optionally specifying some properties.

AntStructure

Generates a DTD for Ant buildfiles which contains information about all tasks currently known to Ant.

Apply

Executes a system command. When the os attribute is specified, then the command is only executed when Ant is run on one of the specified operating systems.

Available

Sets a property if a resource is available at runtime. This resource can be a file, a directory, a class in the classpath, or a JVM system resource.

Chmod

Changes the permissions of a file or all files inside specified directories. Right now it has effect only under Unix. The permissions are also UNIX style, like the argument for the chmod command.

Copy

Copies a file or Fileset to a new file or directory.

Copydir

This task has been deprecated. Use the Copy task instead.

Copyfile

This task has been deprecated. Use the Copy task instead.

Cvs

Handles packages/modules retrieved from a CVS repository.

CVSPass

Adds entries to a .cvspass file. Adding entries to this file has the same affect as a cvs login command.

Delete

Deletes either a single file, all files in a specified directory and its sub-directories, or a set of files specified by one or more FileSets.

Deltree

This task has been deprecated. Use the Delete task instead.

Ear

An extension of the Jar task with special treatment for files that should end up in an Enterprise Application archive.

Echo

Echoes a message to System.out or a file.

Exec

Executes a system command. When the os attribute is specified, then the command is only executed when Ant is run on one of the specified operating systems.

ExecOn

Executes a system command. When the os attribute is specified, then the command is only executed when Ant is run on one of the specified operating systems.

The files and/or directories of a number of FileSets are passed as arguments to the system command. At least one nested <fileset> is required.

Fail

Exits the current build (just throwing a BuildException), optionally printing additional information.

Filter

Sets a token filter for this project or read multiple token filter from an input file and sets these as filters. Token filters are used by all tasks that perform file copying operations through the Project commodity methods.

FixCRLF

Modifies a file to add or remove tabs, carriage returns, linefeeds, and EOF characters.

GenKey

Generates a key in keystore.

Get

Gets a file from a URL.

GUnzip

Expands a GZip file.

GZip

GZips a file.

Jar

Jars a set of files.

Java

Executes a Java class within the running (Ant) VM or forks another VM if specified.

Javac

Compiles a source tree within the running (Ant) VM.

Javadoc/Javadoc2

Generates code documentation using the javadoc tool.

The Javadoc2 task is deprecated. Use the Javadoc task instead.

Mail

A task to send SMTP email.

Mkdir

Creates a directory. Also non-existent parent directories are created, when necessary.

Move

Moves a file to a new file or directory, or sets of files to a new directory.

Patch

Applies a diff file to originals.

PathConvert

Converts a nested path, path reference, or fileset reference to the form usable on a specified platform and stores the result in a given property.

Property

Sets a property (by name and value), or set of properties (from file or resource) in the project.

Record

A recorder is a listener to the current build process that records the output to a file.

Rename

This task has been deprecated. Use the Move task instead.

Replace

Replace is a directory based task for replacing the occurrence of a given string with another string in selected file.

Rmic

Runs the rmic compiler for a certain class.

SignJar

Signs a jar or zip file with the javasign command line tool.

Sleep

A task for sleeping a short period of time, useful when a build or deployment process requires an interval between tasks.

Sql

Executes a series of SQL statements via JDBC to a database. Statements can either be read in from a text file using the src attribute or from between the enclosing SQL tags.

Style

Process a set of documents via XSLT.

Tar

Creates a tar archive.

Taskdef

Adds a task definition to the current project, such that this new task can be used in the current project.

Touch

Changes the modification time of a file and possibly creates it at the same time.

TStamp

Sets the DSTAMP, TSTAMP, and TODAY properties in the current project based on the current date and time.

Typedef

Adds a data type definition to the current project, such that this new type can be used in the current project.

Unjar

Unzips a jarfile.

Untar

Untars a tarfile.

Unwar

Unzips a warfile.

Unzip

Unzips a zipfile.

Uptodate

Sets a property if a target files are more up to date than a set of Source files.

War

An extension of the Jar task with special treatment for files that should end up in the WEB-INF/lib, WEB-INF/classes or WEB-INF directories of the Web Application Archive.

Zip

Creates a zipfile.


Copyright © 2000,2001 Apache Software Foundation. All rights Reserved.