title: How to execute HibernateToolTask from Ant when Hibernate Tools is a Maven dependency
body: <p>I am using Hibernate Tools to generate pojo and dao in my project. It is currently working in the Hibernate perspective using Run > Hibernate Code Generation...
  However, I want to automatize this as part of a more complex build where I need to do some pre-processing, running the hibernate code genaration and doing some post-processing.
  I have an Ant build file for doing this, but I don't know how to reference the Maven dependencies jar </p>
  
  <pre><code>&lt;?xml version="1.0" ?&gt;
  &lt;!DOCTYPE project&gt;
  &lt;project name="Hibernate Tools hbm2java" default="gensrc"&gt;
  
      &lt;path id="tools"&gt;
          &lt;!--
              Here {
          --&gt;
          &lt;path location="lib/hibernate-tools-4.3.1.CR1.jar"/&gt;
          &lt;!-- more dependencies... --&gt;
          &lt;!--
              }
          --&gt;
          ...
      &lt;/path&gt;
      &lt;taskdef name="gen-src" classname="org.hibernate.tool.ant.HibernateToolTask"
               classpathref="tools" /&gt;
      &lt;target name="gensrc"&gt;
          ...
      &lt;/target&gt;
  &lt;/project&gt;
  </code></pre>
  
  <p>I am getting this warning:</p>
  
  <pre><code>taskdef class org.hibernate.tool.ant.HibernateToolTask cannot be found using the classloader AntClassLoader[]
  </code></pre>
  
  <p>with the consequent build error:</p>
  
  <pre><code>BUILD FAILED
  /.../hibernate-gen.xml:16: taskdef class org.hibernate.tool.ant.HibernateToolTask cannot be found using the classloader AntClassLoader[]
  </code></pre>
  
  <p>How can I reference the jar from Maven dependency to call the org.hibernate.tool.ant.HibernateToolTask?</p>