IDE: WTP 2.0 ALL-IN-ONE
Hibernate: 3.2.5.GA
Hibernate Tools: 3.2.0.GA
JDK: 1.5.0_14
Platform: Windows XP SP2
I have met a problem when i tried to code the build.xml like what's shown in the part "Ant target for schema export" of chapter 2 in "Java Persistence with Hibernate", there's always a warning showing that taskdef class org.Hibernate.tool.ant.HibernateToolTask cannot be found even i put all jars below of hibernate tools plugin (noted in hibernate.tools.lib.dir) in the classpath of HelloWorld project.
The build.xml is the following:
Code:
<project name="HelloWorld" default="compile" basedir=".">
<!-- Name of project and version -->
<property name="proj.name" value="HelloWorld"/>
<property name="proj.version" value="1.0"/>
<!-- Global properties for this build -->
<property name="src.java.dir" value="src"/>
<property name="lib.dir" value="lib"/>
<property name="build.dir" value="bin"/>
<!-- Local properties for the use of hibernate 3 tools -->
<property name="hibernate.tools.lib.dir"
value="D:/wtp2.0/eclipse/extra_plugins/hibernate_tools/eclipse/plugins/org.hibernate.eclipse_3.2.0.GA/lib"/>
<!-- Classpath declaration -->
<path id="project.classpath">
<fileset dir="${lib.dir}">
<include name="**/*.jar" />
<include name="**/*.zip" />
</fileset>
</path>
<path id="hibernate3.tools.classpath">
<fileset dir="${hibernate.tools.lib.dir}">
<include name="*.jar" />
</fileset>
<pathelement location="${build.dir}"/>
</path>
<!-- Useful shortcuts -->
<patternset id="meta.files">
<include name="**/*.xml"/>
<include name="**/*.properties"/>
</patternset>
<!-- Clean up -->
<target name="clean">
<delete dir="${build.dir}"/>
<mkdir dir="${build.dir}"/>
</target>
<!-- Compile Java source -->
<target name="compile" depends="clean">
<mkdir dir="${build.dir}"/>
<javac srcdir="${src.java.dir}"
destdir="${build.dir}"
nowarn="on">
<classpath refid="project.classpath"/>
</javac>
</target>
<!-- Copy metadata to build classpath -->
<target name="copymetafiles">
<copy todir="${build.dir}">
<fileset dir="${src.java.dir}">
<patternset refid="meta.files"/>
</fileset>
</copy>
</target>
<!-- Run HelloWorld -->
<target name="run" depends="compile, copymetafiles" description="Build and run HelloWorld">
<java fork="true"
classname="hello.HelloWorld"
classpathref="project.classpath">
<classpath path="${build.dir}"/>
</java>
</target>
<taskdef name="hibernatetool"
classname="org.Hibernate.tool.ant.HibernateToolTask"
classpathref="hibernate3.tools.classpath"/>
<target name="schemaexport" depends="compile, copymetafiles"
description="Exports a generated schema to DB and file">
<hibernatetool destdir="${basedir}">
<classpath path="${build.dir}"/>
<configuration configurationfile="${build.dir}/hibernate.cfg.xml"/>
<hbm2ddl
drop="true"
create="true"
export="true"
outputfilename="helloworld-ddl.sql"
delimiter=";"
format="true"/>
</hibernatetool>
</target>
<target name="dbmanager" description="Start HSQLDB manager">
<java
classname="org.hsqldb.util.DatabaseManagerSwing"
fork="yes"
classpathref="hibernate3.tools.classpath"
failonerror="true">
<arg value="-url"/>
<arg value="jdbc:hsqldb:hsql://localhost/"/>
<arg value="-driver"/>
<arg value="org.hsqldb.jdbcDriver"/>
</java>
</target>
</project>
Can someone help? I would appreciate for that.