Hi,
I'm a recent convert to Maven2 and trying to achieve the same functionality
I used to do with Ant. Most of the things work pretty well but one of the
things I really got stuck on is the SchemaExportTask using Hibernate3. I
tried to install the hibernate3 plugin from the codehaus mojo repository but
didn't succeed because of missing dependencies. Another way I am currently
trying is simply calling the SchemaExportTask using an Ant call. Using this
approach, it seems like the SchemaExportTask cannot be found in the
classpath. I do have a dependency on Hibernate3 in my POM and am passing a
reference to maven.dependency.classpath to and maven-antrun-plugin. For some
reason unclear to me it doesn't seem to work out.
There error I get is:
[INFO]
----------------------------------------------------------------------------
[INFO] Error executing ant tasks
Embedded error: taskdef class
org.hibernate.tool.hbm2ddl.SchemaExportTaskcannot be found
[INFO]
----------------------------------------------------------------------------
Here's how I define the Ant task to run in my POM:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
<phase>package</phase>
<configuration>
<tasks>
<taskdef name="schemaexport"
classname="
org.hibernate.tool.hbm2ddl.SchemaExportTask">
<classpath>
<path refid="maven.dependency.classpath" />
</classpath>
</taskdef>
<mkdir dir="target/schema"/>
<schemaexport quiet="no" text="no" drop="no"
delimiter=";"
output="target/schema/create-tables.sql">
<fileset dir="target/classes"
includes="**/*.hbm.xml"/>
</schemaexport>
</tasks>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>
Has anyone else experienced this problem and want to share his solution or
approach to do a SchemaExportTask in Maven2? Any help appreciated.
Kind regards,
Frederik