I am trying to incoporate the SchemaExport tool into an ant build script. I'm working with jdk1.4.2, ant 1.6, and MySQL 4.0. I did read the FAQ and some of the manual, but I just can't seem to get this to work.
I have a project structure like so:
testroot/build.xml
testroot/src/hibernate.properties
testroot/src/test.hbm.xml
testroot/lib/hibernate2.xml
testroot/lib/mysql-jdbc-driver.jar
Well, I was reading Ch. 19 of the hibernate manual regarding the toolset. I came across an example of how to incorporate the SchemaExport utility into an Ant file. It looks something like this:
<target name="schemaupdate">
<taskdef name="schemaupdate"
classname="net.sf.hibernate.tool.hbm2ddl.SchemaUpdateTask"
classpathref="${class.path}"/>
<schemaupdate
properties="${hibernate.properties}"
quiet="no">
<fileset dir="src">
<include name="**/*.hbm.xml"/>
</fileset>
</schemaupdate>
</target>
I have the hibernate.properties file configured for MySQL. I believe my test.hbm.xml is in the right place under src/. However, I am having a terrible time setting my class.path property. I realize my problem may be a simple java environment problem, but I am looking for a sanity check here. No matter what I set the class.path property to I get some kind of "not found" error in the dos prompt when I run "ant schemaexport".
I've tried setting class.path to:
c:/testroot/lib
c:/testroot/lib/
c:/testroot/lib/*.jar
as well as
c:/hibernate-2.1/lib
c:/hibernate-2.1/lib/
c:/hibernate-2.1/lib/*.jar
So my questions are:
1) Do I need to include more than just the hibernate2.jar and my jdbc driver jar file in my project's lib directory?
2) Is my syntax wrong for the classpathref attribute?
Thanks in advance for any help.
Dan
|