ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Gary Lawson" <g...@sferics.com>
Subject RE: Setting classpath for optional task
Date Fri, 02 Mar 2001 09:45:11 GMT
We used

<path id="project.classpath" >
    <pathelement path="${tomcat_home}/webapps/${project}/WEB-INF/classes" />
    <pathelement location="${ant_home}/lib/ant.jar" />
    <pathelement location="${ant_home}/lib/optional.jar" />
    <pathelement
location="${build_dir}/common/servlet2.2/servletapi/lib/servlet.jar" />
    <pathelement location="${build_dir}/common/junit3.2/junit.jar" />
    <pathelement location="${build_dir}/common/HttpUnit/lib/httpunit.jar" />
    <pathelement
location="${build_dir}/common/JTidy/jtidy-04aug2000r6/build/Tidy.jar" />
</path>
.
.
.
[snip]
.
.
<target name="runtests" depends="init" >
   <junit haltonfailure="off" haltonerror="off" printsummary="on" >
      <classpath refid="project.classpath" />
      <formatter type="plain" />
      <test name="com.blah.blah.AllTests" haltonfailure="off"
haltonerror="off" outfile="alltests" />
   </junit>
</target>

HTH
Gary

-----Original Message-----
From: Nico Seessle [mailto:nico@apache.org]
Sent: 01 March 2001 19:19
To: ant-user@jakarta.apache.org
Subject: Re: Setting classpath for optional task


----- Original Message -----
From: "William Lee" <wlee@sendmail.com>
To: "Ant User" <ant-user@jakarta.apache.org>
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



Mime
View raw message