How do I configure the hbm2java maven2 plugin to generate POJOs for all mapping files

Posted by naor on Stack Overflow See other posts from Stack Overflow or by naor
Published on 2010-05-30T19:43:34Z Indexed on 2010/05/30 19:52 UTC
Read the original article Hit count: 691

Filed under:
|

Hi.

I am trying to migrate my ant build to maven2. in my build.xml I invoke the hbm2java in the following way:

<hibernatetool destdir="/src/generated/">
        <configuration configurationfile="${env.ITP_HOME}/core/xml/hibernate/hibernate.cfg.xml">
            <fileset dir="/xml/hibernate">
                <include name="*.hbm.xml"/>
            </fileset>
        </configuration>
        <hbm2java/>
    </hibernatetool>

my hibernate.cfg.xml is:

<hibernate-configuration>
<session-factory>
 <property name="hibernate.dialect">org.hibernate.dialect.Oracle10gDialect</property>
    <property name="hibernate.connection.driver_class">oracle.jdbc.driver.OracleDriver</property>        
</session-factory>    

in my maven2 POM file I have:

<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>hibernate3-maven-plugin</artifactId>
<version>2.2</version>
<executions>
 <execution>
  <id>hbm2java</id>
  <phase>generate-sources</phase>
  <goals>
   <goal>hbm2java</goal>
  </goals>
  <configuration>
   <components>
    <component>
     <name>hbm2java</name>
     <implementation>configuration</implementation>
     <outputDirectory>/src/main/java</outputDirectory>
    </component>
   </components>
   <componentProperties>
    <jdk5>true</jdk5>
    <configurationfile>/src/main/resources/hibernate.cfg.xml</configurationfile>
   </componentProperties>
  </configuration>      
 </execution>

but when executing mvn hibernate3:hbm2java i see no files get generated unless they are all listed in hibernate.cfg.xml. Is there a way to specify a fileset in the maven configuration similar to the ant task?

thanks, naor

© Stack Overflow or respective owner

Related posts about maven-2

Related posts about hbm2java