----- Original Message -----
From: "Jason Grant" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, July 23, 2001 2:04 AM
Subject: Re: Defining classpath within ant build file


Hi Vincent,

I'm a little confused after looking at the code and trying to understand
the role of the helpers.  I'll walk through my setup, to help me talk
things through:

1) If I don't want to set up an external classpath, then I need to define
a classpath within the taskdef that defines RunServerTestsTask.

[VMA] When you type 'ant', the java classpath that starts Ant is composed of
all the jars in ${ANT_HOME}/lib. If you're using Cactus Ant custom tasks you
can put the commons-cactus-ant.jar file in ${ANT_HOME}/lib (ans then use a
taskdef with no classpath). Or put it anywhere else and then use a taskdef
with a classpath.

2) When RunServerTestsTask is invoked under ant, it internally executes
an 'antcall' to the test task that was defined as a parameter.

[VMA] Yep

3) This antcall corresponds to the "run-tests" target (below).  This
throws a ClassNotDefException for
Junit.Framework.TestListener.

[VMA] I don't know why it says this and I guess you have junit.jar defined
in the classpath. However, I don't think defining all the jars inside the
build file is a good idea. I prefer to externalize the definitions of the
jars in a build.properties file so that I control exactly what jars I used
and I can easily update to newest versions of them. See my other email on
the subject. If you still want to do it your way I have 2 ideas :
- try not using a refid for defining the classpath but rather explicitely
the classpath with junit.jar  in it
- maybe as the "target" that is called is using code from Ant it is loaded
with another class loader and this classloader has not had junit.jar put in
it's classpath.

If I understand you correctly, RunServerTestsTask runs with a specific
classloader, and the antcall to run-tests executes under another.  Are

[VMA] maybe

you suggesting that creation of a custom version of RunServerTestsTask
will fix things, if the new version does not make the antcall itself, but
instead calls a helper that makes the antcall?  If so, I don't understand

[VMA] no

why this should change things, but it's what the cactus code seems to do
in your StartServerTask example?

[VMA] no

J.
-Vincent

Reply via email to