ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cmose <>
Subject classsnotfound exception with junit ant task
Date Wed, 16 Aug 2006 18:39:21 GMT

Wasn't able to find anything on searching the forum regarding this issue. I
turned up a number of items via google but none of them seemed to resolve
the problem I've got. I'm using ant 1.6.5 through eclipse 3.1. 
Specifically I'm using a junit task defined thusly:

<target name="test" depends="compile" unles="do.nojunit">
  <junit printsummary="yes" haltonfailure="yes" showoutput="yes fork="no">
     <classpath refid="classpath.project" />
     <formatter type="xml" />
     <test todir="${testresults.dir}" name="test.AllTests"
outfile="Test-AllTests" />

classpath.project is defined thusly:
<path id="classpath.project">
   <pathelement path="${target.dir}" /> --->this is the bin directory for
class files
   <pathelement path="D:\Lirbaries\*.jar" /> ---> a temporary location for
jar libraries

Now the obnoxious thing is this, Ant runs the junit tests and manages to get
through 65 out of the 72 testcases before throwing the classnotfound
exception. Furthermore,
The class it's saying it can't find, it found in a testcase it ran previous
to the failed testcase (e.g., ClassNotFoundException: MyClass, MyClass was
already exercised in a previous testcase that the ant junit task ran without

Now I should note that this failure is a junit "failure" resulting from an
explicit call to fail() within the testcase (in the event that an unexpected
exception is caught).  The testcase in question calls a utility class that
needs to cast an object to this not found class and that is where the error
is occuring.

All the tests pass just fine when run straight through eclipse.

At this point I'm not really certain what the solution is. Quite possibly
I'm overlooking something simple or obvious - any insight is greatly
View this message in context:
Sent from the Ant - Users forum at

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

View raw message