Hello:
I am new to the wonderful world of Hibernate, so I am trying to run the HelloWorld example from JP with H.
I am trying to run the ant task schemaexport from the following build file:
<project name="Hello World" default="compile" basedir=".">
<!-- Name of project and version -->
<property name="proj.name" value="Hello World"/>
<property name="proj.shortname" value="helloworld"/>
<property name="version" value="1.0"/>
<!-- Global properties for this build -->
<property name="database.dir" value="database"/>
<property name="src.java.dir" value="src"/>
<property name="lib.dir" value="lib"/>
<property name="build.dir" value="build"/>
<!-- Classpath declaration -->
<path id="project.classpath">
<fileset dir="${lib.dir}">
<include name="**/*.jar"/>
<include name="**/*.zip"/>
</fileset>
</path>
<!-- Useful shortcuts -->
<patternset id="meta.files">
<include name="**/*.xml"/>
<include name="**/*.properties"/>
</patternset>
<!-- Clean up -->
<target name="clean" description="Clean the build directory">
<delete dir="${build.dir}"/>
<mkdir dir="${build.dir}"/>
</target>
<!-- Compile Java source -->
<target name="compile">
<mkdir dir="${build.dir}"/>
<javac srcdir="${src.java.dir}"
destdir="${build.dir}"
classpathref="project.classpath"/>
</target>
<!-- Copy metadata to build classpath -->
<target name="copymetafiles">
<mkdir dir="${build.dir}"/>
<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>
<!-- Hibernate Tools import -->
<taskdef name="hibernatetool"
classname="org.hibernate.tool.hbm2ddl.SchemaExportTask"
classpathref="project.classpath"/>
<!-- Export the database schema -->
<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="${proj.shortname}-ddl.sql"
delimiter=";"
format="true"/>
</hibernatetool>
</target>
<!-- Start the HSQL DB server -->
<target name="startdb" description="Run HSQL database server with clean DB">
<!-- Delete database files -->
<delete dir="${database.dir}"/>
<java classname="org.hsqldb.Server"
fork="yes"
classpathref="project.classpath"
failonerror="true">
<arg value="-database.0"/>
<arg value="file:${database.dir}/db"/>
</java>
</target>
<!-- Start the HSQL DB browser tool -->
<target name="dbmanager" description="Start HSQL DB manager">
<java
classname="org.hsqldb.util.DatabaseManagerSwing"
fork="yes"
classpathref="project.classpath"
failonerror="true">
<arg value="-url"/>
<arg value="jdbc:hsqldb:hsql://localhost/"/>
<arg value="-driver"/>
<arg value="org.hsqldb.jdbcDriver"/>
</java>
</target>
</project>
When I run the step I get the following error:
schemaexport:
BUILD FAILED
C:\KBD\dev\hibernate\helloworld\WORKDIR\build.xml:71: hibernatetool doesn't support the "destdir" attribute
When I read the documentation it clearly states that there is a destdir attribute for hibernatetool and it is required.
I have set up my directories and files as follows:
C:\KBD\dev\hibernate>
C:\KBD\dev\hibernate>dir /s
Volume in drive C has no label.
Volume Serial Number is 1824-0333
Directory of C:\KBD\dev\hibernate
03/01/2008 11:38 AM <DIR> .
03/01/2008 11:38 AM <DIR> ..
03/01/2008 11:39 AM <DIR> helloworld
0 File(s) 0 bytes
Directory of C:\KBD\dev\hibernate\helloworld
03/01/2008 11:39 AM <DIR> .
03/01/2008 11:39 AM <DIR> ..
03/01/2008 01:44 PM <DIR> WORKDIR
0 File(s) 0 bytes
Directory of C:\KBD\dev\hibernate\helloworld\WORKDIR
03/01/2008 01:44 PM <DIR> .
03/01/2008 01:44 PM <DIR> ..
03/02/2008 01:01 PM <DIR> build
03/01/2008 02:23 PM 3,750 build.xml
03/01/2008 01:43 PM <DIR> database
11/10/2006 02:34 PM 450 helloworld-ddl.sql
10/19/2006 12:05 PM 3,570 HelloWorld-Native.iml
03/01/2008 02:31 PM <DIR> lib
09/03/2006 05:38 PM 1,823 license.txt
09/20/2006 02:31 PM 1,762 README.txt
03/02/2008 12:35 PM <DIR> src
5 File(s) 11,355 bytes
Directory of C:\KBD\dev\hibernate\helloworld\WORKDIR\build
03/02/2008 01:01 PM <DIR> .
03/02/2008 01:01 PM <DIR> ..
03/02/2008 01:01 PM <DIR> hello
03/02/2008 01:01 PM 1,328 hibernate.cfg.xml
03/02/2008 01:01 PM 501 log4j.properties
03/02/2008 01:01 PM <DIR> persistence
2 File(s) 1,829 bytes
Directory of C:\KBD\dev\hibernate\helloworld\WORKDIR\build\hello
03/02/2008 01:01 PM <DIR> .
03/02/2008 01:01 PM <DIR> ..
03/02/2008 01:01 PM 2,172 HelloWorld.class
03/02/2008 01:01 PM 692 Message.class
03/02/2008 01:01 PM 653 Message.hbm.xml
3 File(s) 3,517 bytes
Directory of C:\KBD\dev\hibernate\helloworld\WORKDIR\build\persistence
03/02/2008 01:01 PM <DIR> .
03/02/2008 01:01 PM <DIR> ..
03/02/2008 01:01 PM 747 HibernateUtil.class
1 File(s) 747 bytes
Directory of C:\KBD\dev\hibernate\helloworld\WORKDIR\database
03/01/2008 01:43 PM <DIR> .
03/01/2008 01:43 PM <DIR> ..
0 File(s) 0 bytes
Directory of C:\KBD\dev\hibernate\helloworld\WORKDIR\lib
03/01/2008 02:31 PM <DIR> .
03/01/2008 02:31 PM <DIR> ..
08/13/2005 03:28 PM 1,034,049 ant-1.6.5.jar
08/13/2005 03:28 PM 5,667 ant-antlr-1.6.5.jar
08/13/2005 03:28 PM 74,237 ant-junit-1.6.5.jar
08/13/2005 03:28 PM 9,180 ant-launcher-1.6.5.jar
08/13/2005 03:28 PM 6,763 ant-swing-1.6.5.jar
05/05/2006 11:58 AM 443,432 antlr-2.7.6.jar
06/03/2004 11:31 AM 1,217 antlr.license.txt
06/03/2004 11:31 AM 11,358 apache.license-2.0.txt
06/03/2004 11:31 AM 2,660 apache.license.txt
03/17/2005 04:05 PM 16,777 asm-attrs.jar
03/17/2005 03:32 PM 26,360 asm.jar
01/19/2007 09:04 AM 608,376 c3p0-0.9.1.jar
06/03/2004 11:31 AM 26,430 c3p0.license.txt
12/02/2005 11:28 AM 282,338 cglib-2.1.3.jar
08/08/2004 06:35 AM 1,204,897 checkstyle-all.jar
07/22/2004 02:24 PM 142,704 cleanimports.jar
06/30/2004 04:59 AM 175,426 commons-collections-2.1.1.jar
07/04/2004 04:49 AM 38,015 commons-logging-1.0.4.jar
06/03/2004 11:31 AM 171,071 concurrent-1.3.2.jar
08/13/2005 03:28 PM 313,898 dom4j-1.6.1.jar
11/03/2006 01:05 PM 208,048 ehcache-1.2.3.jar
02/06/2008 09:31 PM 2,274,768 hibernate3.jar
06/03/2004 11:31 AM 104,359 jaas.jar
06/03/2004 11:31 AM 9,863 jaas.licence.txt
12/23/2004 09:26 PM 24,180 jacc-1_0-fr.jar
11/16/2006 01:46 PM 471,005 javassist.jar
08/16/2005 02:04 PM 226,877 jaxen-1.1-beta-7.jar
02/10/2006 09:39 PM 517,527 jboss-cache.jar
03/16/2005 12:10 AM 583,206 jboss-common.jar
03/16/2005 12:10 AM 591,568 jboss-jmx.jar
03/16/2005 12:10 AM 223,640 jboss-system.jar
12/15/2005 06:06 PM 1,611,518 jgroups-2.2.8.jar
06/03/2004 11:31 AM 8,812 jta.jar
06/03/2004 11:31 AM 9,830 jta.licence.txt
06/03/2004 11:31 AM 121,070 junit-3.8.1.jar
08/13/2005 03:28 PM 350,627 log4j-1.2.11.jar
01/19/2005 10:11 AM 114,308 oscache-2.1.jar
02/21/2008 10:58 AM 474,746 postgresql-8.3-603.jdbc4.jar
06/03/2004 11:31 AM 475,943 proxool-0.8.3.jar
06/03/2004 11:31 AM 30,602 swarmcache-1.0rc2.jar
10/24/2005 06:45 AM 142,026 syndiag2.jar
02/06/2008 09:31 PM 4,754 version.properties
11/14/2004 07:03 AM 5,762 versioncheck.jar
12/19/2004 06:14 PM 1,010,806 xerces-2.6.2.jar
06/03/2004 11:31 AM 123,705 xml-apis.jar
02/06/2008 09:34 PM 2,997 _README.txt
46 File(s) 14,317,402 bytes
Directory of C:\KBD\dev\hibernate\helloworld\WORKDIR\src
03/02/2008 12:35 PM <DIR> .
03/02/2008 12:35 PM <DIR> ..
03/01/2008 01:10 PM <DIR> hello
03/01/2008 01:26 PM 1,328 hibernate.cfg.xml
10/19/2006 12:15 PM 501 log4j.properties
03/02/2008 12:41 PM <DIR> persistence
2 File(s) 1,829 bytes
Directory of C:\KBD\dev\hibernate\helloworld\WORKDIR\src\hello
03/01/2008 01:10 PM <DIR> .
03/01/2008 01:10 PM <DIR> ..
09/20/2006 12:16 PM 2,844 HelloWorld.java
09/20/2006 01:16 PM 653 Message.hbm.xml
09/03/2006 05:38 PM 627 Message.java
3 File(s) 4,124 bytes
Directory of C:\KBD\dev\hibernate\helloworld\WORKDIR\src\persistence
03/02/2008 12:41 PM <DIR> .
03/02/2008 12:41 PM <DIR> ..
09/20/2006 12:10 PM 683 HibernateUtil.java
1 File(s) 683 bytes
Total Files Listed:
63 File(s) 14,341,486 bytes
32 Dir(s) 51,599,917,056 bytes free
C:\KBD\dev\hibernate>
Hibernate version: 3.2.6
Ant version:1.7.0
C:\KBD\dev\hibernate\helloworld\WORKDIR>ant schemaexport -v Apache Ant version 1.7.0 compiled on December 13 2006 Buildfile: build.xml Detected Java version: 1.6 in: C:\progFiles\Java\jdk1.6.0_01\jre Detected OS: Windows XP parsing buildfile C:\KBD\dev\hibernate\helloworld\WORKDIR\build.xml with URI = file:/C:/KBD/dev/hibernate/helloworld/WORKDIR/build .xml Project base dir set to: C:\KBD\dev\hibernate\helloworld\WORKDIR [antlib:org.apache.tools.ant] Could not load definitions from resource org/apache/tools/ant/antlib.xml. It could not be found. Build sequence for target(s) `schemaexport' is [compile, copymetafiles, schemaexport] Complete build sequence is [compile, copymetafiles, schemaexport, startdb, clean, dbmanager, run, ]
compile: [mkdir] Skipping C:\KBD\dev\hibernate\helloworld\WORKDIR\build because it already exists. [javac] hello\HelloWorld.java omitted as C:\KBD\dev\hibernate\helloworld\WORKDIR\build\hello\HelloWorld.class is up to date. [javac] hello\Message.hbm.xml skipped - don't know how to handle it [javac] hello\Message.java omitted as C:\KBD\dev\hibernate\helloworld\WORKDIR\build\hello\Message.class is up to date. [javac] hibernate.cfg.xml skipped - don't know how to handle it [javac] log4j.properties skipped - don't know how to handle it [javac] persistence\HibernateUtil.java omitted as C:\KBD\dev\hibernate\helloworld\WORKDIR\build\persistence\HibernateUtil.clas s is up to date.
copymetafiles: [mkdir] Skipping C:\KBD\dev\hibernate\helloworld\WORKDIR\build because it already exists. [copy] hello\Message.hbm.xml omitted as C:\KBD\dev\hibernate\helloworld\WORKDIR\build\hello\Message.hbm.xml is up to date. [copy] hibernate.cfg.xml omitted as C:\KBD\dev\hibernate\helloworld\WORKDIR\build\hibernate.cfg.xml is up to date. [copy] log4j.properties omitted as C:\KBD\dev\hibernate\helloworld\WORKDIR\build\log4j.properties is up to date. [copy] No sources found.
schemaexport:
BUILD FAILED C:\KBD\dev\hibernate\helloworld\WORKDIR\build.xml:71: hibernatetool doesn't support the "destdir" attribute at org.apache.tools.ant.RuntimeConfigurable.maybeConfigure(RuntimeConfigurable.java:400) at org.apache.tools.ant.RuntimeConfigurable.maybeConfigure(RuntimeConfigurable.java:349) at org.apache.tools.ant.Task.maybeConfigure(Task.java:202) at org.apache.tools.ant.UnknownElement.configure(UnknownElement.java:193) at org.apache.tools.ant.UnknownElement.maybeConfigure(UnknownElement.java:160) at org.apache.tools.ant.Task.perform(Task.java:347) at org.apache.tools.ant.Target.execute(Target.java:357) at org.apache.tools.ant.Target.performTasks(Target.java:385) at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1329) at org.apache.tools.ant.Project.executeTarget(Project.java:1298) at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41) at org.apache.tools.ant.Project.executeTargets(Project.java:1181) at org.apache.tools.ant.Main.runBuild(Main.java:698) at org.apache.tools.ant.Main.startAnt(Main.java:199) at org.apache.tools.ant.launch.Launcher.run(Launcher.java:257) at org.apache.tools.ant.launch.Launcher.main(Launcher.java:104) Caused by: The <hibernatetool> type doesn't support the "destdir" attribute. at org.apache.tools.ant.IntrospectionHelper.setAttribute(IntrospectionHelper.java:396) at org.apache.tools.ant.RuntimeConfigurable.maybeConfigure(RuntimeConfigurable.java:392) ... 15 more --- Nested Exception --- The <hibernatetool> type doesn't support the "destdir" attribute. at org.apache.tools.ant.IntrospectionHelper.setAttribute(IntrospectionHelper.java:396) at org.apache.tools.ant.RuntimeConfigurable.maybeConfigure(RuntimeConfigurable.java:392) at org.apache.tools.ant.RuntimeConfigurable.maybeConfigure(RuntimeConfigurable.java:349) at org.apache.tools.ant.Task.maybeConfigure(Task.java:202) at org.apache.tools.ant.UnknownElement.configure(UnknownElement.java:193) at org.apache.tools.ant.UnknownElement.maybeConfigure(UnknownElement.java:160) at org.apache.tools.ant.Task.perform(Task.java:347) at org.apache.tools.ant.Target.execute(Target.java:357) at org.apache.tools.ant.Target.performTasks(Target.java:385) at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1329) at org.apache.tools.ant.Project.executeTarget(Project.java:1298) at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41) at org.apache.tools.ant.Project.executeTargets(Project.java:1181) at org.apache.tools.ant.Main.runBuild(Main.java:698) at org.apache.tools.ant.Main.startAnt(Main.java:199) at org.apache.tools.ant.launch.Launcher.run(Launcher.java:257) at org.apache.tools.ant.launch.Launcher.main(Launcher.java:104)
Total time: 0 seconds C:\KBD\dev\hibernate\helloworld\WORKDIR>
Database: Postgresql 8.2
need your kind assistance to get back on track.
Many thanks
kd
|