title: How do I copy files into an existing JAR with Ant?
body: <p>I have a project that needs to access resources within its own JAR file.  When I create the JAR file for the project, I would like to copy a directory into that JAR file (I guess the ZIP equivalent would be "adding" the directory to the existing ZIP file).  I only want the copy to happen after the JAR has been created (and I obviously don't want the copy to happen if I clean and delete the JAR file).</p>
  
  <p>Currently the build file looks like this:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;project name="foobar" basedir=".." default="jar"&gt;
  
      &lt;!-- project-specific properties --&gt;
      &lt;property name="project.path" value="my/project/dir/foobar" /&gt;
  
      &lt;patternset id="project.include"&gt;
          &lt;include name="${project.path}/**" /&gt;
      &lt;/patternset&gt;
      &lt;patternset id="project.jar.include"&gt;
          &lt;include name="${project.path}/**" /&gt;
      &lt;/patternset&gt;
  
      &lt;import file="common-tasks.xml" /&gt;
  
      &lt;property name="jar.file" location="${test.dir}/foobar.jar" /&gt;    
      &lt;property name="manifest.file" location="misc/foobar.manifest" /&gt;
  &lt;/project&gt;
  </code></pre>
  
  <p>Some of the build tasks are called from another file (common-tasks.xml), which I can't display here.</p>