title: Ant classes not picked up within maven ant run plugin execution of javac
body: <p>I have an ant project which I am trying to run via maven ant run plugin. I can successfully run the build using ant even though when using ant run plugin I get following exception while compiling sources containing imports to ant classes.</p>
  
  <pre><code>    [javac] xxxx/ant/src/org/apache/hadoop/hive/ant/GetVersionPref.java:21: package org.apache.tools.ant does not exist
  [javac] import org.apache.tools.ant.AntClassLoader;
  [javac]                            ^
  [javac] xxxx/ant/src/org/apache/hadoop/hive/ant/GetVersionPref.java:22: package org.apache.tools.ant does not exist
  [javac] import org.apache.tools.ant.BuildException;
  </code></pre>
  
  <p>Here is the relevant snippet of ant build file.</p>
  
  <p>
      </p>
  
  <pre><code>&lt;property name="myclasspath" refid="classpath"/&gt;
  &lt;!-- Emit the property to the ant console --&gt;
  &lt;echo message="Classpath = ${myclasspath}"/&gt;
  
  &lt;javac
   encoding="${build.encoding}"
   srcdir="${src.dir}"
   includes="**/*.java"
   destdir="${build.classes}"
   debug="${javac.debug}"
   deprecation="${javac.deprecation}"
   includeantruntime="true"&gt;
    &lt;compilerarg line="${javac.args} ${javac.args.warnings}" /&gt;
    &lt;classpath refid="classpath"/&gt;
  &lt;/javac&gt;
  </code></pre>
  
  <p></p>
  
  <p>The printed classpath doesn't contain ant jars in either case (running directly or via ant run plugin) so I am guessing for the first case the ant libraries are implicitly included in javac classpath somehow. Greatly appreciate any suggestion for overcoming this issue.</p>