First of all, sorry for posting on both lists, but I think developers will be
interested also because they might want to update the documentation.
I managed to get the junit task to work without removing it from optional.jar
and without putting it in the $ANT_HOME/lib directory. My solution might not
be the most elegant and efficient one, but it works without much trouble.
These 3 targets do the job
<!-- Set ANT_OPTS to "" if is doesn't exist yet
otherwise "${ANT_OPTS}" will be given to the
java VM -->
<target name="antopts" unless="ANT_OPTS">
<property name="ANT_OPTS" value=""/>
</target>
<!-- Set classpath correct, fork VM and call second test stage -->
<target name="test" depends="compile,antopts">
<!-- Add junit.jar and org.jutil.jar to the classpath -->
<property name="testpath"v
alue="${java.class.path}:${lib}/junit.jar:${lib.dist}/org.jutil.jar"/>
<!-- Run ant again with a different target, but fork the VM so we can add
jars to the classpath
See Ant documentation for reasons why it doesn't work when using <junit>
directly. -->
<java classname="org.apache.tools.ant.Main" fork="true"
classpath="${testpath}">
<jvmarg line="-Dant.home=${ant.home} ${ANT_OPTS}"/>
<arg line="test-secondstage"/>
</java>
</target>
<target name="test-secondstage" depends="init">
<!-- perform tests here -->
</target>
I'm not sure whether it is cross-platform or not, I only use linux.
Happy junit testing,
Marko No. 5
--
Jutil.org - Programming as you know it is over
http://org-jutil.sourceforge.net
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>