-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: build.xml warning of not finding HibernateToolTask
PostPosted: Wed Mar 05, 2008 11:37 am 
Newbie

Joined: Wed Mar 05, 2008 10:52 am
Posts: 1
Location: China
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.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jun 18, 2008 5:53 am 
Newbie

Joined: Fri Jun 13, 2008 12:14 pm
Posts: 7
Hi,

maybe you need some ANT-libs. Don't know exactly which jars, i put all of them into my lib and all of hibernate-tools and it works...

ca


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.