You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Ernst de Haan <zn...@FreeBSD.org> on 2004/01/08 17:50:25 UTC

junit task with custom classpath (Ant 1.6.0)

How do I let Ant 1.6.0 find the junit.jar on a location I specificy?

This is what I tried. This is my directory structure:

   build.xml
   jars/junit.jar

See the attached build.xml.

The junit-avail task does not fail, but the junit-task does! What do I do 
wrong?

This is the output:

$ ant
Buildfile: build.xml

junit-avail:

junit-task:

BUILD FAILED
/usr/home/ernst/tmp/test/build.xml:18: taskdef A class needed by class 
org.apache.tools.ant.taskdefs.optional.junit.JUnitTask cannot be found: 
junit/framework/TestListener


Ernst



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


Re: junit task with custom classpath (Ant 1.6.0)

Posted by Conor MacNeill <co...@cortexebusiness.com.au>.
On Fri, 9 Jan 2004 03:50 am, Ernst de Haan wrote:
> How do I let Ant 1.6.0 find the junit.jar on a location I specificy?
>
> This is what I tried. This is my directory structure:
>
>    build.xml
>    jars/junit.jar
>
> See the attached build.xml.
>
> The junit-avail task does not fail, but the junit-task does! What do I do
> wrong?
>

Hi Ernst,

You can use the -lib option when starting Ant to tell it to look in a 
particular directory for additional library jars.

Conor


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


Re: junit task with custom classpath (Ant 1.6.0)

Posted by Stefan Bodewig <bo...@apache.org>.
On Mon, 12 Jan 2004, Ernst de Haan <er...@nl.wanadoo.com>
wrote:

> Okay, I've got things figured out now using 'ant -jar', but is there
> no way to use a <classpath/> to do the same thing and let the
> <junit/> task find the classes it needs?

There is no way to get this to work if junit.jar and ant-junit.jar are
not loaded by the same classloader, yes.

Stefan

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


Re: junit task with custom classpath (Ant 1.6.0)

Posted by Ernst de Haan <er...@nl.wanadoo.com>.
Okay, I've got things figured out now using 'ant -jar', but is there no way 
to use a <classpath/> to do the same thing and let the <junit/> task find 
the classes it needs?

I still prefer 'ant' over 'ant -lib <some-directory>'...

Ernst


On vrijdag 9 januari 2004 12:11, Ernst de Haan wrote:
> > Or place junit.jar in $ANT_HOME/lib to save a lot of grief.
>
> That's not an option, since I want to create a distribution of a library
> that builds with Ant and that will work, regardless of the available JAR
> files on the host system.
>
> Basically, my distro should be self-sufficient. All you should need is
> Ant 1.5+, the rest comes in the distro.
>
> Attached is the build file.
>
> Ernst

-- 
Wanadoo Nederland BV, http://www.wanadoo.nl & http://www.euronet.nl
Ernst de Haan, Teamleader IS/IT Tech Team
Muiderstraat 1, P.o. BOX 11095, 1001 GB Amsterdam
T:+31 (0)20 535 59 71, F:+31 (0)20 535 51 76
E-mail: ernst.dehaan@nl.wanadoo.com


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


Re: junit task with custom classpath (Ant 1.6.0)

Posted by Stefan Bodewig <bo...@apache.org>.
On Fri, 9 Jan 2004, Ernst de Haan <er...@nl.wanadoo.com> wrote:
>> Or place junit.jar in $ANT_HOME/lib to save a lot of grief.
> 
> That's not an option, since I want to create a distribution of a
> library that builds with Ant and that will work, regardless of the
> available JAR files on the host system.

Then you are up for trouble, sorry.
<http://ant.apache.org/faq.html#delegating-classloader>.

> Basically, my distro should be self-sufficient. All you should need
> is Ant 1.5+, the rest comes in the distro.

Make that 1.6.0+ and tell people to invoke Ant as 

ant -lib jars

(or whatever the directory was named that contains junit.jar).

Stefan

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


Re: junit task with custom classpath (Ant 1.6.0)

Posted by Ernst de Haan <er...@nl.wanadoo.com>.
> Or place junit.jar in $ANT_HOME/lib to save a lot of grief.

That's not an option, since I want to create a distribution of a library 
that builds with Ant and that will work, regardless of the available JAR 
files on the host system.

Basically, my distro should be self-sufficient. All you should need is Ant 
1.5+, the rest comes in the distro.

Attached is the build file.

Ernst

Re: junit task with custom classpath (Ant 1.6.0)

Posted by Peter Reilly <pe...@corvil.com>.
Or place junit.jar in $ANT_HOME/lib to save a lot of grief.
Peter
Stefan Bodewig wrote:

>On Thu, 8 Jan 2004, Ernst de Haan <zn...@freebsd.org> wrote:
>
>  
>
>>   build.xml
>>   jars/junit.jar
>>
>>See the attached build.xml.
>>    
>>
>
>No attachement.
>
>You probably have ant-junit.jar in ANT_HOME/lib which means it will
>get loaded via a parent classloader of the one you've set up in the
>taskdef.  Move it from ANT_HOME/lib to jars and add it to your
><classpath>.
>
>Stefan
>  
>


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


Re: junit task with custom classpath (Ant 1.6.0)

Posted by Stefan Bodewig <bo...@apache.org>.
On Thu, 8 Jan 2004, Ernst de Haan <zn...@freebsd.org> wrote:

>    build.xml
>    jars/junit.jar
> 
> See the attached build.xml.

No attachement.

You probably have ant-junit.jar in ANT_HOME/lib which means it will
get loaded via a parent classloader of the one you've set up in the
taskdef.  Move it from ANT_HOME/lib to jars and add it to your
<classpath>.

Stefan
-- 
http://stefanbodewig.blogger.de/

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