title: Dynamically generate JAR files based on package name with ANT
body: <p>My current build file has the following repetitive tasks:</p>
  
  <pre><code>&lt;jar jarfile="${build.lib}/${prefix}-foo.jar"&gt;
      &lt;fileset dir="${build.classes}"&gt;
          &lt;include name="com/a/c/foo/**"/&gt;
      &lt;/fileset&gt;  
  &lt;/jar&gt;
  &lt;jar jarfile="${build.lib}/${prefix}-bar.jar"&gt;
      &lt;fileset dir="${build.classes}"&gt;
          &lt;include name="com/a/c/bar/**"/&gt;
      &lt;/fileset&gt;
  &lt;/jar&gt;
  </code></pre>
  
  <p>... 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.</p>
  
  <p>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".</p>
  
  <p>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.</p>