ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ray Tayek <rta...@attbi.com>
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"
>file,

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

hth

---
ray tayek http://home.earthlink.net/~rtayek/
actively seeking telecommuting work
orange county java users group http://www.ocjug.org/
hate spam? http://samspade.org/ssw/


--
To unsubscribe, e-mail:   <mailto:ant-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:ant-user-help@jakarta.apache.org>


Mime
View raw message