ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From g...@stinky.com
Subject Re: Basic setup of Junit in Ant?
Date Wed, 13 Mar 2002 17:47:37 GMT
Thanks, Stefan.  I understand the problem now.

> You must have junit.jar and the junit task in the same classpath,
> either (1) both in CLASSPATH or ANT_HOME/lib or (2) none of them.

Okay, so can you put a note to that effect into junit.html?  Something
really clear like,

 Note: If you have optional.jar in ANT_HOME/lib (or your CLASSPATH),
 then you must put junit.jar in ANT_HOME/lib (or your CLASSPATH) as
 well.  See http://nagoya.apache.org/bugzilla/show_bug.cgi?id=6606
 for a full description of this issue, and alternate workarounds for
 it.

Or better yet, add an exception handler to Ant that checks for the
particular exception (ClassNotFound?) when loading a task from
optional.jar, and prints a more descriptive error message.  Right now
it says

	Could not create task of type: junit. Common solutions are to use
	taskdef to declare your task, or, if this is an optional task,
	to put the optional.jar in the lib directory of your ant
	installation (ANT_HOME).

which may be technically accurate, but doesn't really help newbies
solve the problem, since optional.jar *is* in the lib directory.

Another option is to bundle JUnit itself inside optional.jar.  It's
about 122K, but could get a lot smaller if the GUI is removed.  I'm
not sure if the licenses are compatible, but I have a feeling you can
make it work.  Obviously, this opens a can of worms wrt upgrading
JUnit versions, but I thought I'd mention it.

 - A


On Wed, Mar 13, 2002 at 05:21:02PM +0100, Stefan Bodewig wrote:
> On Wed, 13 Mar 2002, <guru@stinky.com> wrote:
> 
> > <p>Note: In order to use this task, you must place
> > <code>junit.jar</code> in your <code>$ANT_HOME/lib</code>
> > directory.</p>
> 
> This is not strictly true.  The full truth is:
> 
> You must have junit.jar and the junit task in the same classpath,
> either (1) both in CLASSPATH or ANT_HOME/lib or (2) none of them.
> 
> See <http://nagoya.apache.org/bugzilla/show_bug.cgi?id=6606> for
> details.
> 
> Stefan
> 
> --
> To unsubscribe, e-mail:   <mailto:ant-user-unsubscribe@jakarta.apache.org>
> For additional commands, e-mail: <mailto:ant-user-help@jakarta.apache.org>
> 

-- 
Alex Chaffee                       mailto:alex@jguru.com
jGuru - Java News and FAQs         http://www.jguru.com/alex/
Creator of Gamelan                 http://www.gamelan.com/
Founder of Purple Technology       http://www.purpletech.com/
Curator of Stinky Art Collective   http://www.stinky.com/

--
To unsubscribe, e-mail:   <mailto:ant-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:ant-user-help@jakarta.apache.org>


Mime
View raw message