You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by thuss2 <th...@greatschools.net> on 2007/05/01 01:05:51 UTC

[m2] Running Hibernates Schema Export Task via Antrun plugin not working

Does anyone have any suggestions on why the Hibernate SchemaExportTask
doesn't seem to work from within the Antrun plugin? The issue appears to be
that it can read the hbm.xml file but it's not finding the corresponding
.class file sitting in the same directory which is in the classpathref being
passed in.

Here's the snippet from pom.xml and the echo shows that the correct
classpath is being passed in:

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-antrun-plugin</artifactId>
    <executions>
        <execution>
            <phase>process-test-resources</phase>
            <configuration>
                <tasks>
                    <property name="x" refid="maven.compile.classpath"/>
                    <echo message="Classpath is set to ${x}"/>
                    <taskdef name="schemaexport"
classname="org.hibernate.tool.hbm2ddl.SchemaExportTask"
                             classpathref="maven.compile.classpath"/>
                    <mkdir dir="target/schema"/>
                    <schemaexport text="no"
properties="target/classes/hibernate.properties"
                                  output="target/schema/create-tables.sql">
                        <fileset dir="target/classes"
includes="**/*.hbm.xml"/>
                    </schemaexport>
                </tasks>
            </configuration>
            <goals>
                <goal>run</goal>
            </goals>
        </execution>
    </executions>
    <dependencies>
        <dependency>
            <groupId>org.hibernate</groupId>
            <artifactId>hibernate-tools</artifactId>
            <version>3.2.0.beta8</version>
        </dependency>
    </dependencies>
</plugin>

then I run mvn -e test, it compiles the classes, finds the hbm.xml file but
then it errors out because SchemaExportTask can't find any of the .class
files:

Caused by: java.lang.ClassNotFoundException: gs.data.admin.Configuration
        at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:306)

even though both the hbm.xml and corresponding .class file are both in
target/classes in the same directory. It's almost as if the SchemaExportTask
isn't able to read the maven.compile.classpath even though my echo statement
prints it out propertly telling me that it's getting through to ant ok.

I know about the Hibernate3 plugin but have an open bug that's preventing me
from using it so I'm trying to get it working with Antrun at the moment.

Any help or suggestions of things to try would be greatly appreciated!

Thanks,
Todd
http://gabrito.com
-- 
View this message in context: http://www.nabble.com/-m2--Running-Hibernates-Schema-Export-Task-via-Antrun-plugin-not-working-tf3672535s177.html#a10262152
Sent from the Maven - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org