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.
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:
<plugin>
<!-- run "mvn hibernate3:hbm2ddl" to generate a schema -->
<groupId>org.codehaus.mojo</groupId>
<artifactId>hibernate3-maven-plugin</artifactId>
<version>3.0</version>
<configuration>
<hibernatetool>
<jpaconfiguration persistenceunit="unitname" />
<hbm2ddl export="false" create="true"
update="true" format="true" outputfilename="schemaDiff.ddl" />
</hibernatetool>
</configuration>
</plugin>
On failures there is the "target/antrun/build-main.xml" file which configures the hibernate tools. For the above example this looks like following:
<?xml version="1.0" encoding="UTF-8" ?>
<project name="maven-antrun-" default="main" >
<target name="main">
<taskdef classname="org.hibernate.tool.ant.EnversHibernateToolTask" name="hibernatetool"/>
<mkdir dir="/home/xxx/workspace/projectname/target/sql/hibernate3"/>
<hibernatetool destdir="/home/xxx/workspace/projectname/target/sql/hibernate3">
<jpaconfiguration persistenceunit="schemaDiff"/>
<hbm2ddl update="true" export="false" outputfilename="schemaDiff.ddl" format=
"true" create="true"/>
</hibernatetool>
</target>
</project>