ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Shawn Castrianni <>
Subject RE: Trying to get Ant + JUnit working peaceably
Date Sat, 05 Jun 2010 22:25:37 GMT
The junit jar is responsible for junit itself, NOT the ability to run junit from ant.  In order
to run junit from ant, you also need the ant-junit.jar in the $ANTHOME/lib directory.  This
should be part of the normal installation of ant so I am not sure why it isn't working for

Since you are new to java, you may not know that you can open up any jar with a zip tool,
like Winzip or winrar.  I do this a lot to inspect the contents of the jar.  If you open up
ant-junit.jar, you will see that the
class is inside.

Shawn Castrianni

-----Original Message-----
From: Steven Harms [] 
Sent: Saturday, June 05, 2010 5:20 PM
Subject: Trying to get Ant + JUnit working peaceably


I'm attempting to learn Java at present and needed to add some
automation around my build and test cycle.  Coming from Ruby, I've got
a real test-first design discipline.

When I attempted to make a <junit> task call, I started getting this
error (I can hear eyes rolling...).

/Users/stharms/java_card/build.xml:38: 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
        -a directory added on the command line with the -lib argument

OK, I'm open to trying to step through the directions.

Most searches and archives suggested that it was paramount to make
sure that the junit library was in $ANTDIR/lib.

In this directory I have both:

junit-3.8.2.jar : retrieved with ant -f fetch.xml -Ddest=system
junit-4.9-SNAPSHOT-20100512-0041.jar : built from github

I then thought, OK let's go with the instructions strictly, what's in
the lib/optional subdir.  Nothing!  OK, so I used the fetch.xml task
to pull the jars into optional.

Re-try, same error.

OK, IRC.  A kind soul there pointed out that on his debian system this
class file was part of optionals.jar that "just worked" as part of
using apt-get ant-optionals.  Hm, regrettably that answer isn't
portable to my platform.

So, I'm stuck.  Can anyone help me get around this low point.  I'm
excited to start programming Java, but I've wound up programming Ant
most of the day -- not a bad thing, just not the shiny app I had
dreamt of :)

Thanks in advance, mysterious guru with the answer,


To unsubscribe, e-mail:
For additional commands, e-mail:

This e-mail, including any attached files, may contain confidential and privileged information
for the sole use of the intended recipient.  Any review, use, distribution, or disclosure
by others is strictly prohibited.  If you are not the intended recipient (or authorized to
receive information for the intended recipient), please contact the sender by reply e-mail
and delete all copies of this message.

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message