Ryan, did you figure this out?  I have my hibernate config files in 
src/main/hbm and added that as a resource in my pom.xml:

   <build>
       <resources>
           <resource>
               <directory>src/main/hbm</directory>
               <filtering>true</filtering>
           </resource>
       </resources>

       <plugins>
           <plugin>
               <groupId>org.codehaus.mojo</groupId>
               <artifactId>hibernate3-maven-plugin</artifactId>
               <version>2.1</version>
               <configuration>
                   <!-- output goes to target/hibernate3 -->
                   <components>
                       <component>
                           <name>hbm2java</name>

                           <implementation>
                               jdbcconfiguration
                           </implementation>
                       </component>

                       <component>
                           <name>hbm2hbmxml</name>

                           <implementation>
                               annotationconfiguration
                           </implementation>
                       </component>

                       <component>
                           <name>hbm2cfgxml</name>

                           <implementation>
                               annotationconfiguration
                           </implementation>
                       </component>

                       <component>
                           <name>hbm2doc</name>

                           <implementation>
                               annotationconfiguration
                           </implementation>
                       </component>

                       <component>
                           <name>hbm2ddl</name>

                           <implementation>
                               annotationconfiguration
                           </implementation>
                       </component>

                       <component>
                           <name>hbm2dao</name>

                           <implementation>
                               annotationconfiguration
                           </implementation>
                       </component>
                   </components>

                   <componentProperties>
                       <!-- the cfg file arrives here after maven has      -->
                       <!-- filtered it.                                   -->
                       <configurationfile>
                           target/classes/hibernate.cfg.xml
                       </configurationfile>

                       <format>true</format>

                       <!-- hbm2java -->
                       <jdk5>true</jdk5>

                       <!-- hbm2java, hbm2cfgxml -->
                       <ejb3>true</ejb3>

                       <!-- hbm2ddl -->
                       <export>true</export>
                       <update>false</update>
                       <drop>true</drop>
                       <create>true</create>
                       <format>true</format>
                       <outputfilename>ddl.sql</outputfilename>

                       <!-- when this is true then failing drops cause a   -->
                       <!-- build failure. this would happen when the      -->
                       <!-- database is empty or if adding a new table.    -->
                       <!-- normally true for postgres, false for hsql.    -->
                       <!-- when adding new tables, etc. just run          -->
                       <!-- mvn hibernate3:hbm2ddl twice to get past the   -->
                       <!-- missing table errors.                          -->
                       <haltonerror>${hbmtool.haltOnError}</haltonerror>
                   </componentProperties>
               </configuration>
           </plugin>

etc.



Ryan Stewart wrote:
I've read the plugin pages at:
http://mojo.codehaus.org/maven-hibernate3/hibernate3-maven-plugin/

But they're sparse at best. I get the idea that the hibernate3 maven plugin
is generally supposed to be configured in the same way as the Hibernate
Tools Ant task, but there's one particular thing I can't see how to do. I'm
trying to convert an existing hbm2ddl ant task that looks like this:
        <hibernatetool destdir="${ddl.dir}">
            <classpath refid="java.classpath" />
            <configuration
propertyfile="${hibernatetools.properties.dir}/hibernate.properties">
                <fileset refid="some.db.mappings" />
                <fileset refid="other.db.mappings" />
            </configuration>
            <hbm2ddl outputfilename="schema-gen.ddl.sql" format="true" />
            <hbm2ddl update="true" create="false" />
        </hibernatetool>

I think I can see how to set the configuration to "configuration" (as
opposed to, say jdbcconfiguration) and how to specify the propertyfile. The
outputfilename, format, update, and create seem to be pretty self-evident as
well. I haven't been able to test them though, because I can't see how to
specify to the hibernate3 maven plugin where my mapping files are. Any
clues? Is there a way to do it similar to the fileset approach in the Ant
task above, or am I going to have to create a hibernate.cfg.xml? I don't
have one of those because the Hibernate config is handled by Spring. Even
that hibernate.properties file referenced by the Ant task is generated by
the build itself. There is no Hibernate-related configuration outside of
Spring.

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

   http://xircles.codehaus.org/manage_email


Reply via email to