How to configure hbm2java and hbm2dao to add packagename to generated classes
        Posted  
        
            by mmm
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by mmm
        
        
        
        Published on 2010-05-17T11:25:22Z
        Indexed on 
            2010/05/17
            11:30 UTC
        
        
        Read the original article
        Hit count: 639
        
Hi,
I'm trying to configure hbm2java with maven to generate POJO classes and DAO objects. One of the issues I'm dealing with is package names aren't generated. I'm using the following pom for that:
<execution>
    <id>hbm2java</id>
    <phase>generate-sources</phase>
    <goals>
        <goal>hbm2java</goal>
    </goals>
    <inherited>false</inherited>
    <configuration>
        <components>
            <component>
                <name>hbm2java</name>
                <implementation>configuration</implementation>
            </component>
        </components>
        <componentProperties>
            <packagename>package.name</packagename>
            <configurationfile>target/hibernate3/generated-mappings/hibernane.cfg.xml</configurationfile>
        </componentProperties>
    </configuration>
</execution>
Yet the generated code begins with the following:
// default package
// Generated 2010-05-17 13:11:51 by Hibernate Tools 3.2.2.GA
/**
 * Messages generated by hbm2java
 */
public class Messages  implements java.io.Serializable {
Is there a way to force maven to generate the package part as defined in packagename?
© Stack Overflow or respective owner