Hi togehter
I've created a simple project for testing hibernate. I have the SchemaExport.bat file for creating tables, and it works perfectly. Now, I want to use
ant with the IDE (
exlipse 3.0). I wrote a simple ant-script, but I have everytime a error message that I can't understand.
Here ist the ant-script:
Code:
<?xml version="1.0" encoding="UTF-8" ?>
<project name="Hibernate-Test" default="all" basedir=".">
<property name="build.dir" value="build" />
<property name="src.dir" value="src" />
<property name="build.classes" value="${build.dir}/classes" />
<property name="build.hibernate" value="${build.dir}/hibernate" />
<property environment="env" />
<property name="hibernate.home" value="D:\Dev\Java\hibernate-2.1" />
<path id="class.path">
<!-- alle hibernate-jars -->
<fileset dir="${hibernate.home}">
<include name="**\*.jar" />
</fileset>
<!-- Klassen im Verzeichnis src -->
<pathelement location="./src" />
<!-- Systemvariable CLASSPATH -->
<pathelement location="${env.CLASSPATH}" />
</path>
<!-- prepare -->
<target name="prepare">
<mkdir dir="${build.dir}" />
<mkdir dir="${build.classes}" />
<mkdir dir="${build.hibernate}" />
</target>
<!-- Compile -->
<target name="compile" depends="prepare" description="compiles all files">
<javac srcdir="${src.dir}" destdir="${build.classes}" classpathref="class.path" />
</target>
<!-- copy files -->
<target name="copy_files" depends="compile">
<copy todir="${build.hibernate}">
<fileset dir="src" includes="*.hbm.xml" />
<fileset dir="." includes="**/*.properties" />
<fileset dir="." includes="*.cfg.xml" />
<fileset dir="${build.classes}" includes="*.class" />
</copy>
</target>
<!-- SchemaExport -->
<target name="create-tables" depends="copy_files">
<taskdef name="schemaexport" classname="net.sf.hibernate.tool.hbm2ddl.SchemaExportTask" classpathref="class.path" />
<schemaexport properties="${build.hibernate}/hibernate.properties" quiet="no" text="no" drop="no" delimiter=";" output="${build}/schema.sql">
<fileset dir="${build.hibernate}">
<include name="*.hbm.xml" />
<include name="*.class" />
</fileset>
</schemaexport>
</target>
<!-- Clean -->
<target name="clean" description="clean up">
<delete dir="${build.dir}" />
</target>
<!-- all -->
<target name="all" depends="clean, create-tables" />
</project>
I can compile and copy all files to directory
build.hibernate. This part of script works fine. But, in the target
create-tables there is a problem. Here is the output after executing of target
all:
Code:
Buildfile: D:\Dev\eclipse\workspace\hibernate_test_2.1\build.xml
clean:
[delete] Deleting directory D:\Dev\eclipse\workspace\hibernate_test_2.1\build
prepare:
[mkdir] Created dir: D:\Dev\eclipse\workspace\hibernate_test_2.1\build
[mkdir] Created dir: D:\Dev\eclipse\workspace\hibernate_test_2.1\build\classes
[mkdir] Created dir: D:\Dev\eclipse\workspace\hibernate_test_2.1\build\hibernate
compile:
[javac] Compiling 4 source files to D:\Dev\eclipse\workspace\hibernate_test_2.1\build\classes
copy_files:
[copy] Copying 8 files to D:\Dev\eclipse\workspace\hibernate_test_2.1\build\hibernate
create-tables:
[schemaexport] log4j:WARN No appenders could be found for logger (net.sf.hibernate.cfg.Environment).
[schemaexport] log4j:WARN Please initialize the log4j system properly.
BUILD FAILED: D:\Dev\eclipse\workspace\hibernate_test_2.1\build.xml:50: Schema text failed: org.dom4j.DocumentException: Error on line 1 of document : Dokumentwurzelelement fehlt Nested exception: Dokumentwurzelelement fehlt
Total time: 3 seconds
Does somebody see, what is wrong im my
build.xml file? Then, if I click on the error-message the following line becomes the blue background:
Code:
<schemaexport properties="${build.hibernate}/hibernate.properties" quiet="no" text="no" drop="no" delimiter=";" output="${build}/schema.sql">
Thanks.