Maven Java Source Code Generation for Hibernate
Posted
by Adam
on Stack Overflow
See other posts from Stack Overflow
or by Adam
Published on 2009-12-14T11:01:57Z
Indexed on
2010/04/30
19:57 UTC
Read the original article
Hit count: 279
Hi,
I´m busy converting an existing project from an Ant build to one using Maven. Part of this build includes using the hibernate hbm2java tool to convert a collection of .hbm.xml files into Java. Here's a snippet of the Ant script used to do this:
<target name="dbcodegen" depends="cleangen" description="Generate Java source from Hibernate XML"> <hibernatetool destdir="${src.generated}"> <configuration>
<fileset dir="${src.config}"> <include name="**/*.hbm.xml"/> </fileset> </configuration>
<hbm2java jdk5="true"/> </hibernatetool>
</target>
I've had a look around on the internet and some people seem to do this (I think) using Ant within Maven and others with the Maven plugin. I'd prefer to avoid mixing Ant and Maven. Can anyone suggest a way to do this so that all of the .hbm.xml files are picked up and the code generation takes place as part of the Maven code generation build phase?
Thanks!
Adam.
© Stack Overflow or respective owner