ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From <>
Subject AW: Broken Junit targets
Date Wed, 15 Feb 2006 08:31:41 GMT
>  <!-- Suggested by Stephen McConnell -->
>  <target name="setup-path" depends="init">
>    <path id="project.main.path">
>      <pathelement location="${ant.jar}"/>
>      <pathelement location="${build.dir}/classes"/>
>    </path>
>    <path id="project.test.path">
>      <path refid="project.main.path"/>
>      <pathelement location="${ant-junit.jar}"/>
>      <pathelement location="${junit.jar}"/>
>    </path>
>  </target>

ok, now your test classes should find Ant´s junit task.

>  <!--  refid changed from test.classpath to setup-path -->
>  <target name="test" depends="test-compile">
>    <junit printsummary="true"

But could Ant find it itself?
While taskdef´ing Ant needs to know
- the implementation class of the task
- all needed external libraries

<junit> is taskdef´ed during the core initialisation (oata/taskdefs/
The implementation class in ANT_HOME\lib\ant-junit.jar and the needed archive is junit.jar.

So junit.jar has to be in Ant´s classpath during Ant´s start: in ANT_HOME\lib, ANT_HOME\lib\optional,
USER_HOME\.ant\lib or in the directory provided via -lib.

Or you taskdef´ it a second time with another name

  <target name="setup-path" depends="init">
      <taskdef name="my.junit" classname="..." classpathref="project.test.path"/>


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message