The following target doesn't work:
Code:
<target name="hibernate_to_java"
description="Generate .java from .hbm files."
depends="hibernate-acer-tl_anagrafica_audit"
>
<taskdef name="hbm2java"
classname="net.sf.hibernate.tool.hbm2java.Hbm2JavaTask"
classpathref="lib.class.path"/>
<hbm2java config="${config.dir}/hbm2java.xml"
output="${java.export.dir}"
>
<fileset dir="${xml.export.dir}">
<include name="**/*.hbm.xml"/>
</fileset>
</hbm2java>
</target>
and causes the following error:
Code:
C:\java\hibernate_generator\build.xml:237: Caused by:
Caused by:
java.lang.NoClassDefFoundError: net/sf/hibernate/MappingException
at net.sf.hibernate.tool.hbm2java.Hbm2JavaTask.processFile(Hbm2JavaTask.java:145)
at net.sf.hibernate.tool.hbm2java.Hbm2JavaTask.execute(Hbm2JavaTask.java:95)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:302)
at org.apache.tools.ant.Task.perform(Task.java:401)
at org.apache.tools.ant.Target.execute(Target.java:338)
at org.apache.tools.ant.Target.performTasks(Target.java:365)
at org.apache.tools.ant.Project.executeTarget(Project.java:1237)
at org.apache.tools.ant.Project.executeTargets(Project.java:1094)
at org.apache.tools.ant.Main.runBuild(Main.java:669)
at org.apache.tools.ant.Main.startAnt(Main.java:220)
at org.apache.tools.ant.launch.Launcher.run(Launcher.java:215)
at org.apache.tools.ant.launch.Launcher.main(Launcher.java:90)
at net.sf.hibernate.tool.hbm2java.Hbm2JavaTask.processFile(Hbm2JavaTask.java:149)
at net.sf.hibernate.tool.hbm2java.Hbm2JavaTask.execute(Hbm2JavaTask.java:95)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:302)
at org.apache.tools.ant.Task.perform(Task.java:401)
at org.apache.tools.ant.Target.execute(Target.java:338)
at org.apache.tools.ant.Target.performTasks(Target.java:365)
at org.apache.tools.ant.Project.executeTarget(Project.java:1237)
at org.apache.tools.ant.Project.executeTargets(Project.java:1094)
at org.apache.tools.ant.Main.runBuild(Main.java:669)
at org.apache.tools.ant.Main.startAnt(Main.java:220)
at org.apache.tools.ant.launch.Launcher.run(Launcher.java:215)
at org.apache.tools.ant.launch.Launcher.main(Launcher.java:90)
but the following target works perfectly !
Both target are from the same build.xml file and have the same classpathref set to ${lib.class.path}.
I'm stuck!
Of course I don't want to list all the xml mapping files and I'd like to use Ant's fileset feature with Hbm2JavaTask.
Code:
<target name="alt-hbm2java" description="Generate ValueObject From Mapping Files">
<java classname="net.sf.hibernate.tool.hbm2java.CodeGenerator" classpathref="lib.class.path">
<arg value="--output=${java.export.dir}"/>
<arg value="${xml.export.dir}\it\tlasf\db\audit\hibernate\model\Action.hbm.xml"/>
</java>
</target>
Please help me.
Thanks in advance.