I think you are correct in thinking that ant is not able to find the hibernate.jar in the classpath but I get this error even after putting a classpath refid line as
Code:
<classpath refid="project.class.path" />
. I did an echo on the reference and it shows the
hibernate.jar in the classpath. So I am unable to understand why the hbm2java task is not able to find it in its classpath. Here is my piece of code from the build.xml
Code:
<!-- Teach Ant how to use Hibernate's code generation tool -->
<taskdef name="hbm2java"
classname="net.sf.hibernate.tool.hbm2java.Hbm2JavaTask"
classpathref="project.class.path" />
<!-- Generate the java code for all mapping files in our source tree -->
<target name="codegen"
description="Generate Java source from the O/R mapping files">
<property name="out.path" refid="project.class.path" />
<echo message="Classpath : \n${out.path}" />
<hbm2java output="${source.root}">
<fileset dir="${source.root}">
<include name="**/*.hbm.xml" />
</fileset>
<classpath refid="project.class.path" />
</hbm2java>
</target>