ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ray Tayek <>
Subject Re: simple ant and junit fails - solved!
Date Tue, 08 Jan 2002 21:04:50 GMT
At 06:33 AM 1/8/02 -0500, you wrote:
>----- Original Message -----
>From: "Ray Tayek" <>
> > those references look nice. but it is not clear what happens if you have a
> > bunch of <classpath...>'s or what there scope is.
>I recommend defining a separate <path id="..."> for unique classpath you
>require, and then reusing it wherever needed with refid.

ok, works fine (see build.xml at end).

> > i did discover something interesting though (see build.xml below). i was
> > able to remove the junit.jar from ant/lib because i had a:
> > classpath=".;d:/classpath/junit.jar" in the <javac...> step. and the
> > <junit..> step apparently "remembers" this (or something) because it
> > worked. but it did not "remember" the "." that was defined in the <javac>
> > step, because i needed to add that explicitly with <classpath> in the
> > <junit> step. intresting.
>Do you have junit.jar in your system classpath (the command-line environment
>where you invoked Ant)?

i did have the file junit.jar in the directory that was in the classpath, 
but it (the file) was not explicitly included in the classpath. i removed 
the junit.jar file from here and pointed to: <pathelement 
path="D:/java/junit3.7"/> . so the junit.jar is not on the classpath 
defined by the command line environment variable. and the junit step still 
apparently "knows" where junit.jar is - strange.


<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="D:/java/junit3.7"/>
     <pathelement location="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
orange county java users group
want privacy?
hate spam?

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

View raw message