You must be able to connect to your database server. I used hsqldb, so you can run the server like this:
Code:
java -cp hsqldb-1.7.1.jar org.hsqldb.Server
in maven.xml:
Code:
<postGoal name="java:compile">
<taskdef name="schemaexport" classname="net.sf.hibernate.tool.hbm2ddl.SchemaExportTask">
<classpath>
<path refid="maven.dependency.classpath"/>
<pathelement location="${maven.build.dest}"/><!-- our classes must be on the classpath -->
</classpath>
</taskdef>
<mkdir dir="${maven.build.dir}/sql"/>
<schemaexport quiet="no" text="true" drop="no" delimiter=";"
properties="${maven.src.dir}/com/foo/bar/myapp/hibernate.properties"
output="${maven.build.dir}/sql/schema-export.sql">
<fileset dir="${maven.xdoclet.hibernatedoclet.destDir}" includes="**/*.hbm.xml"/>
</schemaexport>
</postGoal>
Make sure you have a <dependency> for dom4j in project.xml because schemaexport uses it.