title: adding non-code resources to jar file using Ant
body: <p>I am in the process of packaging my java application into a jar file. I am using ant and eclipse. I need to actually include in the jar a couple of separate, non-code files (xml and txt files) directly under the root folder, not in the same place as the code.</p>
  
  <p>I am trying to use includesfile, but that doesn't seem to work, here is my ant target:</p>
  
  <pre><code>&lt;target name="distribute" depends="compile" includesfile="readthis.txt"&gt;
      &lt;jar destfile="${distributionDir}/myjar.jar" &gt;
          &lt;fileset dir="${outputDir}"/&gt;
      &lt;fileset dir="${sourceDir}"/&gt;           
      &lt;/jar&gt;
  &lt;/target&gt;
  </code></pre>
  
  <p>The above works fine when I omit the includesfile argument. Plus, I need to add multiple non-code files. These files are located directly under the root project folder in Eclipse, and not within any java packages.</p>
  
  <p>Also, as you can see above, I am basically including to the jar my source code as well. Is there a way to tell the jar task to put the source code in a separate folder from the compiled code?</p>
  
  <p>As a compile or build task, Ant easily can separate source code from the compiled classes. But is there a way to do it within a jar file as well? </p>
  
  <p>Many thanks for your time!</p>