ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Pierre Malraison <pierre.malrai...@planetcad.com>
Subject from java to junit
Date Thu, 18 Apr 2002 17:43:23 GMT
I think this is different than the faq:
<style> or <junit> ignores my <classpath>  
if i'm wrong, my apologies

i'm starting with the build.xml supplied with httpunit:

<?xml version="1.0" ?>
<!--
======================================================================= -->
<!--  httpunit unittests  build file
-->
<!--
======================================================================= -->
<project name="unittests" default="test" basedir=".">
    <property name="src.dir" value="src" />
    <property name="jars.dir" value="jars" />

    <property name="classes.dir" value="classes" />
  

    <property name="test_new.class" value="unittests.EnvoyNewTest" />

<!-- =================================================================== -->
<!-- Defines the classpath used for compilation and test.                -->
<!-- =================================================================== -->
<path id="base.classpath">
    <fileset dir="${jars.dir}">
        <include name="*.jar"/>
    </fileset>
    <fileset dir="${ant.home}/lib">
  	<include name ="*.jar" />
    </fileset>
</path>

<!--  ===================================================================
-->
<!--  Compiles the source code
-->
<!--  ===================================================================
-->
<target name="compile">
    <mkdir dir="${jars.dir}" />
    <mkdir dir="${classes.dir}" />
    <javac srcdir="${src.dir}" destdir="${classes.dir}"
           debug="on" deprecation="off" optimize="off">
         <classpath refid="base.classpath" />
    </javac>
</target>


<!--  ===================================================================
-->
<!--  Runs the test code
-->
<!--  ===================================================================
-->
<target name="test-new" depends="compile">

<junit printsummary="yes" fork="yes" haltonfailure="yes">
         <classpath>
             <path refid="base.classpath" />
         </classpath>
  <formatter type="plain" />
  <test name="${test_new.class}" />
</junit>
<!-- the above code replaces 
this:

    <java classname="${test_new.class}" fork="yes" >
        <classpath>
             <path refid="base.classpath" />
             <pathelement location="${classes.dir}" />
             <pathelement location="${classpath}" />
         </classpath>
    </java>
-->

</target>

i have optional.jar in ant_home/lib and it shows up in the class path, but i
still get

ant test-new

Buildfile: build.xml

compile:
    [javac] Compiling 21 source files to E:\iee\qa\unittests\classes

test-new:

BUILD FAILED

E:\iee\qa\unittests\build.xml:56: Could not create task of type: junit.
Common s
olutions are to use taskdef to declare your task, or, if this is an optional
tas
k, to put the optional.jar in the lib directory of your ant installation
(ANT_HOME).

is it the faq or something else obvious i am missing?
thanks

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message