I don't know how this can be included in the junit tests ( at least the part that loads optional tasks ) since the test env already includes most classes. In order to test - you need to run this without junit.jar in ant/lib and to pass the path to junit.jar PR: Obtained from: Submitted by: Reviewed by: git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@273686 13f79535-47bb-0310-9956-ffa450edef68master