I literally wasted 2 hours trying to get ant junit task working. First, I had trouble finding ant-junit.jar
file but I managed to find it in a maven page. After that I put it several places(~/.ant/lib
, /usr/share/ant/lib
) but no luck.. I'm still getting this error:
Cause: the class org.apache.tools.ant.taskdefs.optional.junit.JUnitTask was not found.
This looks like one of Ant's optional components.
So I'm looking for:
- Official web page to download ant junit task files
- Correct place to put that file.
You can download dependencies from Maven Central from an ANT task as follows:
An even better alternative is to use Apache ivy to manage dependencies. An example build file is here:
1. The Ant download distribution
Expurgated tree:
2. Your test classpath
Just like any other test dependency.
(Unrelated, but wouldn't the distro be the absolute first place you'd look? It "literally" took me five minutes to download, uncompress, look for the JUnit-related files, and do a
tar xvf
to sanity-check the missing class ref.)