My current build file has the following repetitive tasks:
<jar jarfile="${build.lib}/${prefix}-foo.jar">
<fileset dir="${build.classes}">
<include name="com/a/c/foo/**"/>
</fileset>
</jar>
<jar jarfile="${build.lib}/${prefix}-bar.jar">
<fileset dir="${build.classes}">
<include name="com/a/c/bar/**"/>
</fileset>
</jar>
... etc. The issue is that the build.xml must be modified for each new package or for each new sub-project. This is a frequent occurrence where I work.
I would like to replace this with logic that will dynamically generate the JARs and their file names based off of a "root" package. So, for example, I could set the root package to be com/a/c, and all packages directly under that package would get their own JAR. Note that all packages under "foo" or "bar" would just be part of "foo.jar" or "bar.jar".
I looked up for loop logic tasks for ANT. I found one in each ant-contrib and JWare/AntXtras, but I could not get either to work as desired.