ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ray Tayek <>
Subject Re: Basic setup of Junit in Ant?
Date Mon, 25 Feb 2002 22:33:19 GMT
At 01:44 PM 2/25/02 -0800, you wrote:
>I... I'd now like to set up to use JUnit. ...
>I'm having trouble understanding exactly what I have to put in the "build.xml"

the script below works for me. you probably have to put junit.jar in 
$ANT_HOME/lib also. be sure you get the optional.jar.

<project name="MyProject" default="dist" basedir=".">
   <property name="src" value="."/>
   <property name="build" value="build"/>
   <property name="dist"  value="dist"/>
   <property name="test"  value="test"/>
   <target name="init">
     <tstamp/> <mkdir dir="${build}"/>
   <target name="compile" depends="init">
     <javac srcdir="${src}" destdir="${build}">
       <pathelement location="/l/junit.jar"/>
   <target name="test" depends="compile">
     <junit fork="yes" printsummary="on"  haltonfailure="true">
         <pathelement path="build"/>
       <test name="MainTest"/>
       <formatter type="brief" usefile="false"/>
   <target name="dist" depends="test">
     <mkdir dir="${dist}/lib"/>
     <jar jarfile="${dist}/lib/MyProject-${DSTAMP}.jar" basedir="${build}"/>
   <target name="clean">
     <delete dir="${build}"/>
     <delete dir="${dist}"/>


ray tayek
actively seeking telecommuting work
orange county java users group
hate spam?

To unsubscribe, e-mail:   <>
For additional commands, e-mail: <>

View raw message