From: "Stefan Bodewig" <[EMAIL PROTECTED]>

> On Thu, 21 Feb 2002, Jose Alberto Fernandez <[EMAIL PROTECTED]>
> wrote:
> 
> >> But even then, we wouldn't solve the current problems.
> > 
> > Why not? 
> 
> There is this task MyEnhancedJunitTask that inherits from JUnitTask.
> I put this task into a jar in my system classpath.  In my build file I
> say
> 
> <taskdef name="myjunit" classname="MyEnhancedJunitTask" />
> 
> No problem in Ant 1.4 as JUnitTask is on the system classpath as
> well.  But as soon as MyEnhancedJunitTask gets loaded from the system
> classloader (and it will be because of the delegating nature of
> AntClassLoader), it will not see JUnitTask in a setup where it has
> been loaded by a different classloader.
> 

So what, it that is your case, you could either:

    a) move your task out of the CLASSPATH and into the same ./autolib 
subdirectory
        as where JunitTask lives (e.g., ./autolib/junit/junittask.jar)

    b) move JunitTask's jar back into ./lib/junittask.jar 

    c) add %ANT_HOME%/autolib/junit/junittask.jar to your CLASSPATH for the 
build.

    d) do not put things in your CLASSPATH, bad practice, and instead use:
        <taskdef name="myjunit" classname="MyEnhancedJunitTask" >
            <classpath loaderid="junit" path="mylibrary.jar" />
        </taskdef>

I personally prefer (a), if you do not want to touch your buildfile or bacth 
file.
(b) just puts you back on thodays scenario so it should work just fine.
(c) is awful, but it will not affect other projects; (d) I think it is best but 
you 
have to touch things around.

Jose Alberto



--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to