title: Java Ant build with external libraries
body: <p>I have following target in mz ant script to build my java application</p>
  
  <pre><code>&lt;target name="jar" depends="compile" description="generate jar"&gt;
      &lt;jar jarfile="${build.dir}/jar/final.jar" basedir="${build.dir}/classes"&gt;
          &lt;manifest&gt;
              &lt;attribute name="Main-Class" value="my.package.Main" /&gt;
          &lt;/manifest&gt;
      &lt;/jar&gt;
  &lt;/target&gt;
  </code></pre>
  
  <p>What I need is to somehow include log4j into the jar, as it throws a NoClassDefFoundError when running with</p>
  
  <pre><code>java -jar final.jar
  </code></pre>
  
  <p>What is the best way to achieve that?</p>
  
  <p>Best,
  Will</p>