Use <foreach>
with a nested <FileSet>
Foreach requires ant-contrib.
Updated Example for recent ant-contrib:
<target name="foo">
<foreach target="bar" param="theFile">
<fileset dir="${server.src}" casesensitive="yes">
<include name="**/*.java"/>
<exclude name="**/*Test*"/>
</fileset>
</foreach>
</target>
<target name="bar">
<echo message="${theFile}"/>
</target>
This will antcall the target "bar" with the ${theFile} resulting in the current file.