title: How do I change the destination directory of Ant's fileset command?
body: <p>I have an Ant buildfile for a Java library. It looks something like this:</p>
  
  <pre class="lang-xml prettyprint-override"><code>&lt;project ... &gt;&lt;target ... &gt;
  &lt;jar destfile="C:\path\to\export.jar"&gt;
      &lt;manifest&gt; ... &lt;/manifest&gt;
      &lt;fileset dir="C:\path\to\bin" /&gt;
      &lt;fileset dir="C:\path\to\src" /&gt;
      &lt;fileset dir="C:\path\to\doc" /&gt;
      &lt;zipfileset src="C:\path\to\included\library.jar" /&gt;
  &lt;/jar&gt;
  &lt;/target&gt;&lt;/project&gt;
  </code></pre>
  
  <p>The only problem is that my JavaDoc is being exported directly into the root directory of the resulting jar file. Essentialy, I'd like some equivalent of the <code>&lt;copydir&gt;</code> command that can be used inside the <code>&lt;jar&gt;</code> command.</p>
  
  <p>My desired structure is this:</p>
  
  <pre class="lang-none prettyprint-override"><code>export.jar
    META-INF
      Manifest.MF
    com
      example
        whatever
          Blah.class
          Blah.java
    org
      external
        somelibrary
          Magic.class     // contents of the included library jar file
    doc
      // javadoc files here
  </code></pre>
  
  <p>The current structure is:</p>
  
  <pre class="lang-none prettyprint-override"><code>export.jar
    META-INF
      Manifest.MF
    com
      example
        whatever
          Blah.class
          Blah.java
          // some javadoc files here
    org
      external
        somelibrary
          Magic.class     // contents of the included library jar file
    // more javadoc files here
  </code></pre>
  
  <hr>
  
  <p>My current "solution" is to omit the documentation <code>&lt;fileset&gt;</code> command, then, once the jar has exported, go into Windows Explorer and <strong>right click</strong> &rarr; <strong>7-Zip</strong> &rarr; <strong>Open Archive</strong>; I can then drop the <code>doc</code> directory in there just fine. However, this pretty completely defeats the purpose of Ant as a completely automated build system.</p>
  
  <p>If it matters, this file was originally generated by Eclipse with the Runnable JAR exporter. However, I obviously need to modify it to add source files, etc. because it's a library and not actually a runnable jar. I exported it as a runnable jar to get Eclipse to package in the required libraries; apparently libraries on the build path aren't available for export via the standard <strong>File</strong> &rarr; <strong>Export</strong> &rarr; <strong>JAR file</strong>.</p>