ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stefan Bodewig <bode...@apache.org>
Subject Re: Setting classpath for optional task
Date Tue, 06 Mar 2001 06:53:52 GMT
William Lee <wlee@sendmail.com> wrote:

> I'm using JUnit 3.5 and Ant 1.3b3.

Let me see

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

this doesn't include the optional task itself, just JUnit.


>    <!-- I was using this before, but didn't work also.  My JUnit is
>    in
> the ../lib directory. 
>          ANT_HOME is the current directory (where this build.xml is)
>     <classpath refid="classpath"/>
>     -->

This should work.

Could you please try the following snippet

<project name="dummy" basedir="." default="run-tests">
  <path id="test">
    <!-- here is JUnit 3.5 -->
    <pathelement location="../lib/junit.jar" /> 
    <!-- here is the optional task, adapt as necessary -->
    <pathelement location="${ant.home}/lib/jakarta-ant-1.3-optional.jar" /> 
  </path>

  <taskdef name="junit"
           classname="org.apache.tools.ant.taskdefs.optional.junit.JUnitTask">
    <classpath refid="test" />
  </taskdef>

  <target name="echo">
    <property name="test" refid="test" />
    <echo message="CLASSPATH for JUnit is ${test}" />
  </target>

  <target name="run-tests">
    <!-- add the command for a single testcase here -->
    <junit .... />
  </target>
</project>

Confirm that all JARs are where you think they are. If all else fails,
run ant -debug (please use the released 1.3 version) and send the
output in private mail.

Stefan

Mime
View raw message