ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jacob Kjome <h...@visi.com>
Subject Re: junit.jar or not?
Date Wed, 21 Jan 2004 05:37:19 GMT
At 09:25 PM 1/20/2004 -0800, you wrote:
>Jan,
>
>1. So, it is correct that we need seperate junit.jar?
>2. What is the usual practice for location of junit.jar? Most posts
>indicated that it should be in ANT_HOME/lib directory?
>
>Thanks

Any Ant-Optional task which has dependencies which don't ship with Ant 
itself need that dependency to be loaded in the same classloader as the 
optional task itself.  Thus, junit.jar must exist in ANT_HOME/lib (OR 
${user.home}/.ant/lib as of Ant-1.6.0).  You need to understand how 
classloaders work to see why this is.  child classloaders can see parent 
classloaders, but not vice-versa.  As such, if you create a <classpath> 
(child classloader) inside your build file containing junit.jar, the 
optional task (in the parent classloader) won't be able to see this 
classloader and, as such, won't find the necessary dependencies to run the 
<junit> task.  The only way to avoid this is to remove the optional junit 
task from ANT_HOME/lib and load both the junit optional task plus the 
junit.jar in your own <classpath> within the build.xml.

If I were you, I would just bit the bullet and make adding junit.jar to 
ANT_HOME/lib (or user.home/.ant/lib) the first thing that you do after you 
install Ant.

Jake


>B.
>
>----- Original Message -----
>From: <Jan.Materne@rzf.fin-nrw.de>
>To: <user@ant.apache.org>
>Sent: Monday, January 19, 2004 10:48 PM
>Subject: RE: junit.jar or not?
>
>
>Yep.
>But in earlier time Ant has its own copy of junit.jar - but that was an
>accident :-)
>
>Jan
>
> > -----Original Message-----
> > From: Baz [mailto:barry@goodconsultants.com]
> > Sent: Monday, January 19, 2004 9:57 PM
> > To: Ant Users List
> > Subject: Re: junit.jar or not?
> >
> >
> > Jan,
> >
> > Thanks for your reply.
> >
> > So, basically, both ant 1.6 and 1.5.x still need a copy of
> > junit.jar in
> > ANT_HOME/lib, right?
> >
> > Barry
> >
> > ----- Original Message -----
> > From: <Jan.Materne@rzf.fin-nrw.de>
> > To: <user@ant.apache.org>
> > Sent: Sunday, January 18, 2004 10:44 PM
> > Subject: RE: junit.jar or not?
> >
> >
> > The ant-junit.jar contains (compiled) classes which depends on JUnit.
> > If you want to use them (e.g. <junit>) you have to have
> > junit.jar in your
> > classpath. E.g. in $ANT_HOME/lib/ or in $USER_HOME/.ant/lib/
> >
> > If you compile Ant´s source distro without JUnit that file
> > (ant-junit.jar)
> > should be empty (or not present, not sure).
> >
> >
> > Jan
> >
> > > -----Original Message-----
> > > From: Baz ¤Ñª° [mailto:sky_fox1@yahoo.com]
> > > Sent: Monday, January 19, 2004 4:16 AM
> > > To: ant-user@jakarta.apache.org
> > > Subject: junit.jar or not?
> > >
> > >
> > > All,
> > >
> > > I am using 1.6 ant. In the $ANT_HOME/lib, there is an ant-junit.jar,
> > > and when i compile the code, ant complains no junit.jar. So if i put
> > > the junit.jar (3.8.1), things are working just like 1.5.x... Whats
> > > the deal? Should I have junit.jar added or not? I am a little
> > > confused.
> > >
> > > Thanks
> > >
> > > Barry
> > >
> > >
> > >
> > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> > > For additional commands, e-mail: user-help@ant.apache.org
> > >
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> > For additional commands, e-mail: user-help@ant.apache.org
> >
>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
>For additional commands, e-mail: user-help@ant.apache.org


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


Mime
View raw message