title: Ant can't find an ant class (DateUtils) while building
body: <p>I'm trying to get a project to build via ant. It builds just fine via ant on my local machine, but on our build machine I get :</p>
  
  <pre><code>java.lang.NoClassDefFoundError: org/apache/tools/ant/util/DateUtils
      at org.apache.tools.ant.DefaultLogger.formatTime(DefaultLogger.java:323)
      at org.apache.tools.ant.DefaultLogger.buildFinished(DefaultLogger.java:170)
      at org.apache.tools.ant.Project.fireBuildFinished(Project.java:        
      at org.apache.tools.ant.Main.runBuild(Main.java:778)
      at org.apache.tools.ant.Main.startAnt(Main.java:217)
      at org.apache.tools.ant.launch.Launcher.run(Launcher.java:257)
      at org.apache.tools.ant.launch.Launcher.main(Launcher.java:104)
  Caused by: java.lang.ClassNotFoundException: org.apache.tools.ant.util.DateUtils
      at java.net.URLClassLoader$1.run(URLClassLoader.java:217)
      at java.security.AccessController.doPrivileged(Native Method)
      at java.net.URLClassLoader.findClass(URLClassLoader.java:205)
      at java.lang.ClassLoader.loadClass(ClassLoader.java:319)
      at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:294)
      at java.lang.ClassLoader.loadClass(ClassLoader.java:264)
      at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:332)
  </code></pre>
  
  <p>This happens within the jaxb-code-generation target and happens when it calls a simple ant copy method. The class it can't find (DateUtils) is within the ant.jar itself and I can't figure out how to get it to load the ant.jar for this target (which I would have thought already had the ant.jar available since it's running within ant). I know this is a classpath problem but cannot figure out how to fix it.</p>
  
  <p>Here's the part of the ant build file up to the copy that fails:</p>
  
  <pre><code>&lt;target name="jaxb-code-generation" depends="xjc-typedef-target,-do-init,-init-macrodef-javac"&gt;
      &lt;mkdir dir="${build.generated.sources.dir}/jaxb" xmlns:s="http://xml.netbeans.org/schema/JAXBWizConfig"/&gt;
      &lt;mkdir dir="build/generated/jaxbCache" xmlns:s="http://xml.netbeans.org/schema/JAXBWizConfig"/&gt;
      &lt;mkdir dir="build/generated/jaxbCache/Listing"/&gt;
      &lt;xjc package="Listing" destdir="build/generated/jaxbCache/Listing" catalog="catalog.xml"&gt;
          &lt;classpath&gt;
              &lt;pathelement location="${src.dir}"/&gt;
              &lt;pathelement path="${jaxbwiz.xjcrun.classpath}"/&gt;
          &lt;/classpath&gt;
          &lt;arg value="-xmlschema"/&gt;
          &lt;schema file="xml-resources/jaxb/Listing/Listing.xsd"/&gt;
          &lt;depends file="xml-resources/jaxb/Listing/Listing.xsd"/&gt;
          &lt;produces dir="build/generated/jaxbCache/Listing"/&gt;
      &lt;/xjc&gt;
      &lt;copy todir="${build.generated.sources.dir}/jaxb"&gt;
          &lt;fileset dir="build/generated/jaxbCache/Listing"/&gt;
      &lt;/copy&gt;
  </code></pre>
  
  <p>Again, this works fine on my local machine. Both my local machine and the build machine are running Java 1.6 and Ant 1.7.1 and both are linux (mine is Linux Mint and the build machine is Ubuntu).</p>
  
  <p><strong>UPDATE:</strong> Data point: I created a new build.xml that just copies a file, that's it. it used the same ant  method and that worked fine when run solo.</p>