Hallo,
I can't get ant to generate a *.sql-file for me. Generating the mapping-files from XDoclet works, but the next step fails with a "Schema text failed: Resource: com/myPackage/Test.hbm.xml not found"-Message. More information attached.
Any ideas where to start searching to get it working?
smo
Ant-Output:
Code:
Buildfile: D:\da\workspace\OOD\build.xml
clean:
[delete] Deleting directory D:\da\workspace\OOD\dest_hibernate
prepareHibernate:
[echo] Creating required directories...
[mkdir] Created dir: D:\da\workspace\OOD\dest_hibernate
compileXDoclet:
[javac] Compiling 1 source files to D:\da\workspace\OOD\dest_hibernate
XDoclet2hbm:
[hibernatedoclet] (XDocletMain.start 47 ) Running <hibernate/>
[hibernatedoclet] Generating mapping file for com.myPackage.Test.
[hibernatedoclet] com.myPackage.Test
hbm2ddl:
[copy] Copying 1 files to D:\da\workspace\OOD\dest_hibernate
[schemaexport] 15.12.2004 09:40:55 net.sf.hibernate.cfg.Environment <clinit>
[schemaexport] INFO: Hibernate 2.1.7
[schemaexport] 15.12.2004 09:40:55 net.sf.hibernate.cfg.Environment <clinit>
[schemaexport] INFO: hibernate.properties not found
[schemaexport] 15.12.2004 09:40:55 net.sf.hibernate.cfg.Environment <clinit>
[schemaexport] INFO: using CGLIB reflection optimizer
[schemaexport] 15.12.2004 09:40:55 net.sf.hibernate.cfg.Environment <clinit>
[schemaexport] INFO: using JDK 1.4 java.sql.Timestamp handling
[schemaexport] 15.12.2004 09:40:55 net.sf.hibernate.cfg.Configuration configure
[schemaexport] INFO: configuring from file: hibernate.cfg.xml
[schemaexport] 15.12.2004 09:40:56 net.sf.hibernate.cfg.Configuration addResource
[schemaexport] INFO: Mapping resource: com/myPackage/Test.hbm.xml
BUILD FAILED: D:\da\workspace\OOD\build.xml:136: Schema text failed: Resource: com/myPackage/Test.hbm.xml not found
My build.xml:
Code:
[...]
<property name="origin.src.dir" location="WEB-INF/src"/>
<property name="origin.lib.dir" location="WEB-INF/lib"/>
<property name="dest_hibernate.root.dir" location="dest_hibernate"/>
[...]
<target name="hbm2ddl" depends="XDoclet2hbm" description="Generates schema with hbm.xml and classfiles">
<taskdef name="schemaexport" classname="net.sf.hibernate.tool.hbm2ddl.SchemaExportTask">
<classpath>
<fileset dir="${dest_hibernate.root.dir}">
<include name="**/*.class"/>
<include name="**/*.hbm.xml"/>
</fileset>
<fileset dir="${origin.lib.dir}">
<include name="hibernate2.jar"/>
<include name="dom4j-1.4.jar"/>
<include name="commons-logging.jar"/>
<include name="commons-collections.jar"/>
<include name="ojdbc14.jar"/>
</fileset>
</classpath>
</taskdef>
<!-- Copy hbm-files to hibernate-dir -->
<copy todir="${dest_hibernate.root.dir}">
<fileset dir="${origin.src.dir}">
<include name="**/*.hbm.xml"/>
</fileset>
</copy>
<!-- Execute the schemaexport task -->
<schemaexport
config="${origin.src.dir}/hibernate.cfg.xml"
quiet="no"
text="yes"
drop="yes"
delimiter=";"
output="${dest_hibernate.root.dir}/schema-export.sql">
</schemaexport>
</target>
My hibernate.cfg.xml:
Code:
<?xml version='1.0' encoding='utf-8'?>
<!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD 2.0//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-2.0.dtd">
<hibernate-configuration>
<session-factory>
<property name="connection.url">jdbc:oracle:thin:@localhost:1521:TEST1</property>
<property name="connection.driver_class">oracle.jdbc.driver.OracleDriver</property>
<property name="connection.username">TEST</property>
<property name="connection.password">TEST</property>
<property name="show_sql">true"</property>
<property name="dialect">net.sf.hibernate.dialect.Oracle9Dialect</property>
<!-- Mapping files -->
<mapping resource="com/myPackage/Test.hbm.xml"/>
</session-factory>
</hibernate-configuration>