www.scmGalaxy.com
for example, the build file may have a task to run file C, and can specify that before the file C can be run, package B needs to be compiled, and before package B is compiled, package A must be compiled.
<project name="MyProject" default="dist" basedir=".">
<description>
simple example build file
</description>
<!-- set global properties for this build -->
<property name="src" location="src"/>
<property name="build" location="build"/>
<property name="dist" location="dist"/>
<target name="init">
<!-- Create the time stamp -->
<tstamp/>
<!-- Create the build directory used by compile -->
<mkdir dir="${build}"/>
</target>
<target name="compile" depends="init"
description="compile the source " >
<!-- Compile code from ${src} into ${build} -->
<javac srcdir="${src}" destdir="${build}"/>
</target>
<target name="dist" depends="compile"
description="generate the distribution" >
<!-- Create the distribution directory -->
<mkdir dir="${dist}/lib"/>
<!-- Put everything in ${build} into the MyProject-${DSTAMP}.jar file -->
<jar jarfile="${dist}/lib/MyProject-${DSTAMP}.jar" basedir="${build}"/>
</target>
<target name="clean"
description="clean up" >
<!-- Delete ${build} and ${dist} dirs -->
<delete dir="${build}"/>
<delete dir="${dist}"/>
</target>
</project>
<ant/>
calls a target in another build file
useful to build subprojects
<ant antfile="subproject/subbuild.xml" dir="subproject" target="compile"/>
<cvs/>
executes any CVS command
<cvs cvsRoot=":pserver:anoncvs@cvs.apache.org:/home/cvspublic" package="ant" dest="${ws.dir}" />
<exec/>
executes a system command
<exec dir="${src}" executable="cmd.exe" os="Windows 2000" output="dir.txt"> <arg line="/c dir"/> </exec>
<javadoc/>
generates javadoc HTML files from Java source files
<javadoc packagenames="com.dummy.test.*"
sourcepath="src"
excludepackagenames="com.dummy.test.doc-files.*"
destdir="docs/api" author="true" version="true" />
<mail/>
sends email using SMTP
<mail from="me" tolist="you" subject="Results of nightly build" files="build.log"/>
<mkdir/>
creates a directory and any missing parent directories
<mkdir dir="${dist}"/>
<sql/>
executes a sequence of SQL statements specified in the build file or an external text file, output can be written to a file
<sql driver="org.database.jdbcDriver" url="jdbc:database-url" userid="sa" password="pass" src="data.sql" >
insert into table some_table values(1,2,3,4);
</sql>
<unjar/>
expands a JAR file
<untar/>
expands a TAR file
The ANT manual at ant.apache.org
http://ant.apache.org/manual/