Thread:
 No need to put stuff in Ant's classpath. 
 PatrickPeak   10 Mar 2005, 13:38 

Comment
Prev. thread 
 Next thread
 
Prev. posting 
 Next posting
From: PatrickPeak (10 Mar 2005, 13:38) Replies: 0, Views: 42217
Subject: No need to put stuff in Ant's classpath.
The key is to use the <taskdef's classpath> to get the .hbm.xml and
.class files into the class path. So something like this.

<property name="build.classes.dir" location="${build.dir}/classes"/>
<property name="generated.classes.dir" location="${build.dir}/generated"/>

<path id="project.classpath">
    <fileset refid="hibernate.jar.fileset"/> // Location of hibernate2.jar
    <fileset refid="hibernate.dependancy.fileset"/> // H2's lib jars
    <fileset refid="xdoclet.fileset"/> // location of xdoclet's jar
</path>
<path id="schema.export.classpath">
    <path refid="project.classpath" />
    <fileset refid="mysql.fileset"/> // MySQL driver
    <pathelement location="${generated.classes.dir}"/> // Hbm files here
    <pathelement location="${build.classes.dir}"/> // Compiles .class
files here
</path>

<target name="schemaexport" depends="compile">
    <taskdef name="schemaexport"
        classname="net.sf.hibernate.tool.hbm2ddl.SchemaExportTask"
        classpathref="schema.export.classpath"/>
    <schemaexport config="${generated.classes.dir}/hibernate.cfg.xml" />
</target>
Prev. thread 
 Next thread
 
Prev. posting 
 Next posting
© Copyright 2006, Red Hat Middleware, LLC. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc. [Privacy Policy]