title: compiling nested jars using ant
body: <p>I have a Java project,<code>Parent</code>, which depends on a <code>Child</code> sub-project (in the form of a JAR).  This <code>Child</code> depends on library <code>A</code> and <code>B</code> and those get bundled in with <code>Child</code>.  <code>Parent</code> uses <code>A</code>and <code>B</code> as well (meaning direct calls, not indirect through <code>Child</code>.  I want to be able to include <code>A</code> and <code>B</code> JARs only once in my project.</p>
  
  <p>When I am compiling <code>Parent</code>, I get a <code>cannot find symbol</code> when it references libraries <code>A</code> and <code>B</code>.  I believe this is because <code>Child</code> is on the compile time path, but for some reason the libraries within it are not.</p>
  
  <p>I am using ant as my building tool - is there anything special I should be doing in my javac tags for nested jars?  Right now in <code>Parent</code>'s build.xml I have:</p>
  
  <pre><code>&lt;target name="compile" depends="clean, makedir"&gt;
      &lt;javac 
          srcdir="${src.dir}"
          destdir="${build.dir}"
          includeantruntime="false"
          classpathref="build.classpath"&gt;
      &lt;/javac&gt;
  &lt;/target&gt;
  
  &lt;path id="build.classpath"&gt;
      &lt;fileset dir="${lib.dir}"&gt;
          &lt;include name="**/*.jar" /&gt;
      &lt;/fileset&gt;
  &lt;/path&gt;
  </code></pre>
  
  <p>This should be including all of the jars present in my lib folder, but it doesn't seem to include all of the jars within jars.</p>