阅读更多
<?xml version="1.0" encoding="ISO-8859-1"?>
<project name="Hibernate Sample" default="hibernate" basedir=".">
<property name="lib.dir" value="${basedir}/lib" />
<property name="src.dir" value="${basedir}/src" />
<property name="test_src.dir" value="${basedir}/test" />
<property name="classes.dir" value="${basedir}/WEB-INF/classes" />
<property name="xDoclet.lib.dir" value="${lib.dir}/xDoclet" />
<property name="generated" value="${classes.dir}" />
<path id="project.class.path">
<fileset dir="${lib.dir}">
<include name="**/*.jar"/>
</fileset>
<pathelement path="${classes.dir}" />
<pathelement path="${generated}" />
</path>
<fileset id="hibernate.mapping.files" dir="${classes.dir}">
<include name="**/*.hbm.xml" />
</fileset>
<!-- =================================================================== -->
<!-- Initialise -->
<!-- =================================================================== -->
<target name="init">
<tstamp>
<format property="TODAY" pattern="d-MM-yy"/>
</tstamp>
<taskdef
name="hibernatedoclet"
classname="xdoclet.modules.hibernate.HibernateDocletTask"
classpathref="project.class.path"
/>
</target>
<!-- =================================================================== -->
<!-- Invoke XDoclet's hibernate -->
<!-- =================================================================== -->
<target name="hibernate" depends="init" description="Generate mapping documents">
<echo>+---------------------------------------------------+</echo>
<echo>| |</echo>
<echo>| R U N N I N G H I B E R N A T E D O C L E T |</echo>
<echo>| |</echo>
<echo>+---------------------------------------------------+</echo>
<delete dir="${generated}" />
<mkdir dir="${generated}"/>
<hibernatedoclet destdir="${generated}">
<fileset dir="${src.dir}">
<include name="**/entity/*.java"/>
</fileset>
<hibernate version="2.0"/>
</hibernatedoclet>
<copy todir="${classes.dir}">
<fileset dir="${generated}"/>
</copy>
</target>
<!-- =================================================================== -->
<!-- Clean -->
<!-- =================================================================== -->
<target name="clean">
<delete dir="${generated}"/>
</target>
<!-- =================================================================== -->
<!-- Initialize Database -->
<!-- =================================================================== -->
<!--
<target name="initdb">
<pathconvert refid="hibernate.mapping.files"
property="hibernate.mappings" pathsep=" "/>
<java classname="net.sf.hibernate.tool.hbm2ddl.SchemaExport" fork="true">
<arg line="${hibernate.mappings}"/>
<classpath refid="project.class.path" />
</java>
</target>
-->
<!-- =================================================================== -->
<!-- Initialize All -->
<!-- =================================================================== -->
<!--
<target name="initAll" depends="hibernate, initdb" />
-->
<!--
<path id="myclasspath">
<fileset dir="${lib}">
<include name="*.jar"/>
</fileset>
<pathelement location="${build}"/>
</path>
<target name="build">
<mkdir dir="${build}" />
<javac classpathref="myclasspath" srcdir="${src}" destdir="${build}">
<include name="**/*.java" />
</javac>
<copy todir="${build}" >
<fileset dir="src/java" >
<exclude name="**/*.java"/>
</fileset>
</copy>
</target>
-->
</project>