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 execute goal org.codehaus.mojo:hibernate3-maven-plugin:3.0:hbm2ddl (create sql schema) on project sample: There was an error creating the AntRun task. NullPointerException -> [Help 1]org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.codehaus.mojo:hibernate3-maven-plugin:3.0:hbm2ddl (create sql schema) on project framework: There was an error creating the AntRun task.
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.
The way of configuration changed to direct usage of the ant hibernate tool plugin. So the configuration is exactly the same format like the ant plugin without the need of additional taskDef for e.g. jpaconfiguration. See hibernate ant tool references documentation: http://docs.jboss.org/tools/3.3.0.Final/en/hibernatetools/html_single/index.html#d0e4651 for more information.
For a hbm2ddl with a jpa configuration you could use the following:
On failures there is the "target/antrun/build-main.xml" file which configures the hibernate tools. For the above example this looks like following:
I have make it work as following:
The basic idea is to use the goal 'run' and then configure hibernatetool to run the exporters you want. So you can run multiple exporters in one go by adding more exporters configuration inside the tag. For more information, look here http://docs.jboss.org/tools/2.0.0.GA/hibernatetools/en/html_single/index.html and http://mojo.codehaus.org/hibernate3-maven-plugin/examples/run-multiple-goals.html. It took me a couple of hours to figure out. Hope that help!