René Nyffenegger's collection of things on the web
René Nyffenegger on Oracle - Most wanted - Feedback -
 

ANT

Ant understands ftp, telnet/ssh, SCM (Such as cvs, SourceSafe, PVCS, SourceOffsite etc), eMailing. These features should help automate anything in a build/deployment/packaging/backup procedure.

Setting ANT_HOME

The environment variable ANT_HOME must be set, otherwise the following error message is displayed when ant is invoked: ANT_HOME is set incorrectly or ant could not be located. Please set ANT_HOME
The value of this variable must point to the directory in which ant was installed, for example c:\tools\bin\apache-ant-1.6.1
By default, ant chooses build.xml for the build instructions.

Options

-projecthelp

This ask Ant to display the project documentation. It requires a build.xml file.

Usual targets

The following targets are usually provided:
  • clean
  • compile
  • all
  • javadoc
  • dist

clean

This target deletes any existing build and dist directories. This guarantees that a build will recompile all java classes.

compile

This target compiles any java file that is newer than its respective class file. Usually, this is made the default target by means of the attribute named default in the tag named project).

all

This is a shortcut target that first runs the clean target then the compile target.

javadoc

This target creates the API documentation with javadoc.
This target is usually a dependeny of the dist target, not of the compile target.

dist

This target creates the .war file.

Options

-f

Names the build file to be used. If the flag is absent, Ant will use the default build file build.xml.

-D

This option is used to give a value to a property. In the following example, the property foo will be set to bar.
ant -Dfoo=bar