ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ray Tayek <>
Subject Re: ant & junit works on win98, fails on deadrat 6.2
Date Mon, 28 Jan 2002 14:52:59 GMT
At 10:56 AM 1/28/02 +0100, you wrote:
>junit is not on your CLASSPATH on deadrat (whatever that may be) but
>on Windows and the way you add it in the build file doesn't work:
> >    <path id="compileClasspath">
> >      <pathelement path="/usr/java"/>
> >      <pathelement location="junit.jar"/>
> >    </path>
>Adds the directory /usr/java and the file junit.jar that lives in your
>basedir to the classpath.  Make the second one
>   <pathelement location="/usr/java/junit.jar"/>
>and it should work.

great! that made the compile work. now i get:

[ray@k6 junit]$ ant
Buildfile: build.xml
/home/ray/junit/build.xml:17: Could not create task of type: junit. Common 
solutions are to use taskdef to declare your task, or, if this is an 
optional task, to put the optional.jar in the lib directory of your ant 
installation (ANT_HOME).
Total time: 4 seconds

i do have an optional.jar in the lib directory. there are 3 junit*.xsl 
files in there. do i need more?


<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"/>
   <path id="compileClasspath">
     <!-- <pathelement path="/usr/java"/> -->
     <pathelement location="/usr/java/junit.jar"/>
   <target name="init"> <tstamp/> <mkdir dir="${build}"/> </target>
   <target name="compile" depends="init">
     <javac srcdir="${src}" destdir="${build}">
       <classpath refid="compileClasspath"/>
   <target name="test" depends="compile">
     <junit fork="yes" printsummary="on"  haltonfailure="true">
       <classpath> <pathelement path="."/> </classpath>
           <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