Writing Ant Tasks
Subject:   using classpath vs jar
Date:   2004-11-23 21:22:00
From:   Xapp
Response to: using classpath vs jar

<project name="Add" default="dist" basedir=".">
The simple ant file to build and test Add.
<!-- set global properties for this build -->
<property name="src" location="src"/>
<property name="build" location="build"/>
<property name="dist" location="dist"/>
<property environment="env"/>

<target name="init">
<mkdir dir="${build}"/>

<target name="compile" depends="init"
description="compile the source " >
<javac srcdir="${src}" destdir="${build}" classpath="${env.ANT_HOME}/lib/ant.jar"/>

<target name="dist" depends="compile"
description="generate the distribution" >
<mkdir dir="${dist}/lib"/>

<!-- Put everything in ${build} into the MyProject-${DSTAMP}.jar file -->
<jar jarfile="${dist}/lib/MyProject-${DSTAMP}.jar" basedir="${build}"/>

<target name="test" depends="compile">
<taskdef name="Add" classname="net.rsherk.ant.Add" classpath="${build}"/>
<Add op1="1" op2="2"/>
<target name="clean"
description="clean up" >
<!-- Delete the ${build} and ${dist} directory trees -->
<delete dir="${build}"/>
<delete dir="${dist}"/>