title: How to use ivy to build a war with out copying jars to a lib directory
body: <p>My goal is have my ant build script build a war file and include the jars that ivy knows this project depends on. The best code I could come up with at the moment is the following</p>
  
  <pre><code>&lt;mkdir dir="dist/lib"/&gt;
  &lt;ivy:retrieve pattern="dist/lib/[artifact].[ext]" sync="true"/&gt;
  &lt;war destfile="dist/${ivy.module}.war" basedir="build" includes="**/*.class"
      webxml="${war.webxml}"&gt;
      &lt;fileset dir="${war.web}"/&gt;
      &lt;lib dir="dist/lib"/&gt;
  &lt;/war&gt;
  </code></pre>
  
  <p>The problem with this code is it copies the jars twice. Once in to my dist/lib directory and again in to the war when it's created. It works but I can't shake the feeling there is a better way.</p>
  
  <p>What I would like to do is something more like the following </p>
  
  <pre><code>&lt;ivy:cachepath pathid="locpathref.classpath"/&gt;
  &lt;war destfile="dist/${ivy.module}.war" basedir="build" includes="**/*.class"
      webxml="${war.webxml}"&gt;
      &lt;fileset dir="${war.web}"/&gt;
      &lt;lib refid="locpathref.classpath"/&gt;
  &lt;/war&gt;
  </code></pre>
  
  <p>The problem is that the lib tag does not take in a refid of any kind. Any ideas or am I stuck with an extra set of file copies?</p>