Alex Rivera | Logout

Unable to generate hbm2ddl using hibernate3-maven-plugin-3.0

Asked 2012-02-14T12:23:24.997
13

I have updated to a newer version of hibernate3-maven-plugin. I get the following error trying to use the plugin mentioned below.

Would appreciate any pointers in resolving this issue.

<plugin>
    <groupId>org.codehaus.mojo</groupId>
    <artifactId>hibernate3-maven-plugin</artifactId>
    <version>3.0</version>

    <executions>
        <execution>
            <id>create sql schema</id>
            <phase>process-test-resources</phase>
            <goals>
                <goal>hbm2ddl</goal>
            </goals>
            <configuration>
                <componentProperties>
                    <persistenceunit>${app.module}</persistenceunit>
                    <drop>false</drop>
                    <create>true</create>
                    <outputfilename>${app.sql}-create.sql</outputfilename>
                    <skip>${db.schema.gen.skip}</skip>
                </componentProperties>
            </configuration>
        </execution>

        <execution>
            <id>drop sql schema</id>
            <phase>process-test-resources</phase>
            <goals>
                <goal>hbm2ddl</goal>
            </goals>
            <configuration>
                <componentProperties>
                    <persistenceunit>${app.module}</persistenceunit>
                    <drop>true</drop>
                    <create>false</create>
                    <outputfilename>${app.sql}-drop.sql</outputfilename>
                    <skip>${db.schema.gen.skip}</skip>
                </componentProperties>
            </configuration>
        </execution>
    </executions>
</plugin>

[ERROR] Failed to exec
Edit
Report

1 Answer

3

I had this same issue, and in the end it was solved by following this example (http://www.celinio.net/techblog/?p=1125) and by specifying the hibernate deps for the plugin alone. This is because in my case I have a separate domain object module which only uses JPA2 (no specific hibernate references), so I needed to pull in the deps for the DDL generation, without worrying about them affecting the dependents of this module.

<build>
    <plugins>
        <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>hibernate3-maven-plugin</artifactId>
            <version>3.0</version>
            <configuration>
                <components>
                    <component>
                        <name>hbm2ddl</name>
                        <implementation>jpaconfiguration</implementation>
                    </component>
                </components>
                <hibernatetool>
                    <classpath>
                        <path location="${project.build.directory}/classes" />
                        <path location="${project.basedir}/src/main/resources/META-INF/" />
                    </classpath>
                    <jpaconfiguration persistenceunit="Configuration" />
                    <hbm2ddl create="true" export="false" drop="true"
                        outputfilename="configuration.sql" format="true" console="true" />
                </hibernatetool>
            </configuration>
            <dependencies>
                <dependency>
                    <groupId>org.hibernate.javax.persistence</groupId>
                    <artifactId>hibernate-jpa-2.0-api</artifactId>
                    <version>1.0.0.Final</version>
           
answered 2012-03-02T04:18:17.747

Your Answer