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 

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

<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"

   <!-- Classpath declaration -->
   <path id="project.classpath">
      <fileset dir="${lib.dir}">
         <include name="**/*.jar" />
         <include name="**/*.zip" />

   <path id="hibernate3.tools.classpath">
      <fileset dir="${hibernate.tools.lib.dir}">
         <include name="*.jar" />
      <pathelement location="${build.dir}"/>

   <!-- Useful shortcuts -->
   <patternset id="meta.files">
      <include name="**/*.xml"/>
      <include name="**/*.properties"/>

   <!-- Clean up -->
   <target name="clean">
      <delete dir="${build.dir}"/>
      <mkdir dir="${build.dir}"/>

   <!-- Compile Java source -->
   <target name="compile" depends="clean">
      <mkdir dir="${build.dir}"/>
      <javac srcdir="${src.java.dir}"
         <classpath refid="project.classpath"/>

   <!-- Copy metadata to build classpath -->
   <target name="copymetafiles">
      <copy todir="${build.dir}">
         <fileset dir="${src.java.dir}">
            <patternset refid="meta.files"/>

   <!-- Run HelloWorld -->
   <target name="run" depends="compile, copymetafiles" description="Build and run HelloWorld">
      <java fork="true"
         <classpath path="${build.dir}"/>

   <taskdef name="hibernatetool"
   <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"/>
   <target name="dbmanager" description="Start HSQLDB manager">
         <arg value="-url"/>
         <arg value="jdbc:hsqldb:hsql://localhost/"/>
         <arg value="-driver"/>
         <arg value="org.hsqldb.jdbcDriver"/>

Can someone help? I would appreciate for that.

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

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

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...


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.