Ant

 
 
Ant is an open-source Java-based build tool. The configuration files are XML-based, calling out a target tree where various tasks get executed. Each task is run by an object that implements a particular Task interface.

The binary distribution of Ant includes the latest version of the Apache Xerces2 XML parser. Ant is distributed at no charge for commercial or non-commercial use. For more information read the LICENSE file.

The latest Ant version can be downloaded from: http://ant.apache.org/







Examples build.xml.



Information
none

Operating system used
Windows XP Home Edition Version 5.1 SP 2

Software prerequisites
Ant 1.5.1

Procedure
To run Ant the following commands can be used:

ant
runs Ant using the build.xml file in the current directory, on the default target.

ant -f test.xml
runs Ant using the test.xml file in the current directory, on the default target.

ant -f test.xml dist
runs Ant using the test.xml file in the current directory, on the target called dist.

ant -f test.xml -Dbuild=build/classes dist
runs Ant using the test.xml file in the current directory, on the target called dist, setting the build property to the value build/classes.



Examples:
Description Files
This script opens the Windows Notepad application.
This script works on a Windows environment.
Download ant build_demo1.xml.
This script creates a jar file. Download ant build_demo2.xml.
This script changes the modification time of all *.htm files within a specified directory. Download ant build_demo3.xml.
This script displays all *.htm files in a selected directory and its subdirectories. Download ant build_demo4.xml.
This script reads a "data.txt" file and searches in this file all lines containing the word "john". This line is added in a file called data_updated.txt. Download ant build_demo5.xml.
Download data_ant.txt.
This script searches within a specified directory all *.htm files. Each time a htm file has been found the HTML tidy application is applied upon this file.
This build script works on a Windows environment.
Download ant build_demo6.xml.
Download config_tidy.txt.
This script converts SHTML files (SSI Server Side Includes) into HTM files. Download ant build_demo7.xml.
This script unjar a jar file, decompiles all class files using the Jad decompiler and creates a new jar file containing the decompiled class files. Download ant build_demo8.xml.
This script optimizes a javascript file for download speed. It removes excess whitespace, comments and removes linebreaks from the javascript file. Download build_demo9.xml.
This script plays a sound. Download ant build_demo10.xml.
Download complete.wav and download error.wav
This script does the following:
  • builds the java code
  • creates a jar file
  • creates an HTML file containing version information
Download ant build_demo11.xml.
This build script requires 2 files: version.properties and version.html
A comprehensive Ant Core Task Quick Reference has been compiled by Tim O'Brien.

Download Ant Core Task Quick Reference.