<target name="-test">
<!-- default values -->
<property name="-test.includes" value="**/Test*.class" />
<property name="-test.excludes" value="" />
<junit fork="yes" dir="${-test.dir}">
<fileset dir="${-test.classdir}"
includes="${-test.includes}"
excludes="${-test.excludes}" />
</junit>
</target>
<target name="test">
<antcall target="-test">
<param name="-test.dir" location="dir1" />
<param name="-test.classdir" location="classdir1" />
</antcall>
<antcall target="-test">
<param name="-test.dir" location="dir2" />
<param name="-test.classdir" location="classdir2" />
<param name="-test.includes" value="**/*Test*.class" />
<param name="-test.excludes" value="NotThisTest.class" />
</antcall>
</target>
Which is actually longer than your contrived example ;-)
Eh, it's because Ant is not supposed to be functional/scripty... --DD
> -----Original Message-----
> From: Clint Shank [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, June 03, 2003 1:57 PM
> To: [EMAIL PROTECTED]
> Subject: junit Looping?
>
> I need to execute a set of junit tasks that differ only in the directory
> from which the VM is invoked and the set of JUnit tests that are run.
> The copy and paste solution (showing only relevant nodes) looks like this:
>
> <junit fork="yes" dir="dir1">
> <fileset
> dir="classdir1"
> includes="**/Test*.class"
> />
> </junit>
> <junit fork="yes" dir="dir2">
> <fileset
> dir="classdir2"
> includes="**/*Test*.class"
> excludes="NotThisTest.class"
> />
> </junit>
>
> There are about five of these junit elements. Any suggestions to reduce
> the duplication?
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]