Using Ant Task Junit produces missing library error

I’d like the ability to execute my unit tests in compiled form instead of having all the classes sitting in a directory. I’ve investigated some of the options available for this, and it seems that Ant is the most likely candidate. I can get this working on the command line directly using JUnit, but am having issues modifying the default Gradle Ant task to contain a needed library:

Problem: failed to create task or type junit

Cause: the class was not found.

This looks like one of Ant’s optional components.

Action: Check that the appropriate optional JAR exists in


-the IDE Ant configuration dialogs

I’m using the Groovy plugin, and have all the JUnit libraries necessary in compile (and testCompile for that matter)… but I’m having issues getting this included in my Ant class path.


You will need to add a configuration containing ant-junit jar to the classpath in your ‘taskdef’ call. See section 17.1.1 of the manual for an example of doing that.

1 Like