junit.jar and Ant
At last no more messing about copying junit.jar or modifying your system classpath to get JUnit to work with Ant. Version 1.7 allows you to specify its location in a classpath element in your build file.
See the last point from the manual page for the JUnit task:
Note: You must have junit.jar available. You can do one of:
1. Put both junit.jar and ant-junit.jar in ANT_HOME/lib.
2. Do not put either in ANT_HOME/lib, and instead include their locations in your CLASSPATH environment variable.
3. Add both JARs to your classpath using -lib.
4. Specify the locations of both JARs using a element in a in the build file.
5. Leave ant-junit.jar in its default location in ANT_HOME/lib but include junit.jar in the passed to . (since Ant 1.7)
One thing to be careful of, make sure you include the junit.jar file that you want, you probably want to make the classpath element specifying the location of the junit.jar file the first classpath element in your junit task - I spent quite a bit of time trying to work out why the tests annotated with the new JUnit 4 @Test annotation weren’t getting run only to eventually find a JUnit 3.1 junit.jar file from the Spring Framework in the classpath before the JUnit 4 junit.jar file.