----- Original Message -----
From: "William Lee" <[EMAIL PROTECTED]>
To: "Ant User" <[EMAIL PROTECTED]>
Sent: Thursday, March 01, 2001 6:47 PM
Subject: Setting classpath for optional task


> Is there a way I can set the classpath for the optional tasks WITHIN the
> ant build.xml?  For now, if I want to use a task such as JUnit, I need
> to set the classpath explicitly before I call the ant main class.  Since
> I don't really want to depend on the environment variable CLASSPATH for
> various reasons, I can't really use the "ant" script to invoke the
> build.xml that has a JUunit task.  I ended up writing something similar
> to the "ant" with my custom CLASSPATH.  Is there anyway to get around
> it?

You could try to "redefine" the junit-task using something like

<taskdef name="junit"
classname="org.apache.tools.ant.taskdefs.optional.junit.JUnitTask">
  <classpath>
    <fileset dir="./lib">
       <include name="junit.jar"/>
    </fileset>
  </classpath>
</taskdef>

Don't know if this works (and if I have made some errors above) - just try
it.

Nico


Reply via email to