error with following target <target name="test" depends="build,properties"> <junit printsummary="yes" haltonerror="yes" haltonfailure="yes"> <formatter type="brief"/> <classpath> <pathelement location="${classes.dir}"/> <pathelement location="${base.dir}\properties"/> <pathelement location="${unity.jar}"/> <fileset dir="${lib.dir}"> <include name="**/*.jar"/> </fileset> </classpath> <test name="test.AllTests"/> </junit> </target> where lib.jar contains both mytask.jar and junit.jar The ant junit task does not utilise the settings of the classpath correctly. It seems to expect the junit jar to be made available prior to the classpath statement telling it where to locate the jar and thus fails. Its clearly visible in the ant code. I have had to deploy junit.jar into the ant lib folder which is not good. Also an additional task I have written needs to be deployed into the lib folder before it will pick it up, is there any way around this.
The alternative is to remove optional.jar from ANT_HOME/lib and put it into a classpath that contains junit.jar as well inside a taskdef to redeclare <junit>. *** This bug has been marked as a duplicate of 6606 ***
More precise duplicate.
*** This bug has been marked as a duplicate of 38799 ***