I use Ant to run Schemaexport to create the table. But when I run the build.xml, I alway got the following error information. I checked all the files and the path. Everything is right.
--------------------------------------------
Buildfile: C:\java\software\workingplace\eclipse\workspace\Hibernate3_Test\build.xml
shemaexport:
[schemaexport] log4j:WARN No appenders could be found for logger (org.hibernate.cfg.Environment).
[schemaexport] log4j:WARN Please initialize the log4j system properly.
BUILD FAILED
C:\java\software\workingplace\eclipse\workspace\Hibernate3_Test\build.xml:43: Schema text failed: Resource: org/gaofeng/hibernate/hbm/Event.hbm.xml not found
---------------------------------------------
Here are my all xml file:
1. hibernate.cfg.xml:
--------------------------------
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
<session-factory>
<property name="connection.username">gaofeng</property>
<property name="connection.password">gaofeng</property>
<property name="dialect">org.hibernate.dialect.PostgreSQLDialect</property>
<property name="connection.url">jdbc:postgresql:hibernate</property>
<property name="connection.driver_class">org.postgresql.Driver</property>
<property name="show_sql">true</property>
<mapping resource="org/gaofeng/hibernate/hbm/Event.hbm.xml"/>
</session-factory>
</hibernate-configuration>
2. build.xml
-----------------------------------
<project name="hibernate-tutorial" default="compile">
<property name="sourcedir" value="${basedir}/src"/>
<property name="targetdir" value="${basedir}/classes"/>
<property name="libdir" value="${basedir}/lib"/>
<path id="libraries">
<fileset dir="${libdir}">
<include name="**/*.jar"/>
</fileset>
</path>
<target name="clean">
<delete dir="${targetdir}"/>
<mkdir dir="${targetdir}"/>
</target>
<target name="copy-resources">
<copy todir="${targetdir}">
<fileset dir="${sourcedir}">
<exclude name="**/*.java"/>
</fileset>
</copy>
</target>
<target name="compile" depends="clean,copy-resources">
<javac srcdir="${sourcedir}"
destdir="${targetdir}"
classpathref="libraries"/>
</target>
<target name="shemaexport" depends="compile">
<taskdef name="schemaexport"
classname="org.hibernate.tool.hbm2ddl.SchemaExportTask"
classpathref="libraries">
</taskdef>
<schemaexport
config="${targetdir}/hibernate.cfg.xml"
quiet="yes"
text="yes"
drop="yes"
delimiter=";"
output="schema-export.sql">
<fileset dir="${targetdir}">
<include name="**/*.hbm.xml"/>
</fileset>
</schemaexport>
</target>
</project>
|