I have the an build.xml that allows me to run junit tests. Here is the relevant part:
The JUnit library resides wherever you tell it to reside. Personally, I would forget entirely about linking against the jar files shipped with Eclipse and instead download the jars directly.
If I have a project, say at path /project
then I would try to put the dependency somewhere in that hierarchy, like at /project/test/lib/junit.jar
. If my ant build file is then /project/build.xml
then it's as simple as adding ./test/lib/junit.jar
to the JUnit classpath. Trying to reference an arbitrary location on your machine is fragile (remember, Eclipse could be installed anywhere), particularly when using relative paths (since your project contents could also be stored anywhere).