A <taskdef> ignores its stated classpath settings in cases when the classname attribute can be resolved via the default ant classpath. This setup: <path id="junit.runtime.path"> <pathelement location="${cvs.checkout}/gate5ag/Devel/Java/Lib/jakarta/ant-optional.jar" /> <pathelement location="${cvs.checkout}/gate5ag/Devel/Java/Lib/junit/junit.jar" /> </path> <taskdef name="junit" classname="org.apache.tools.ant.taskdefs.optional.junit.JUnitTask" classpathref="junit.runtime.path" /> gives me a ClassNotFoundExc because junit.framework.TestListener cannot be found if optional.jar is in $ANT_HOME/lib, and junit.jar is not. Removing optional.jar from $ANT_HOME/lib fixes this; adding junit.jar to $ANT_HOME/lib does fix it as well. Seems to me that taskdef ignores my classpath if it can load org.apache.tools.ant.taskdefs.optional.junit.JUnitTask via the default classloader, then tries to load the junit classes via the default CL as well. Of course this fails in the above setup. Why does taskdef use the boot CL in the first place?
*** This bug has been marked as a duplicate of 6606 ***
More precise duplicate.
*** This bug has been marked as a duplicate of 38799 ***