154 lines
5.6 KiB
XML
154 lines
5.6 KiB
XML
<!--
|
|
===================================================================
|
|
build
|
|
===================================================================
|
|
-->
|
|
<project name="crud" default="compile">
|
|
|
|
<!-- environment -->
|
|
<property environment="env"/>
|
|
<property name="project.location" location="."/>
|
|
<property name="project.build.debug" value="on"/>
|
|
<property name="Name" value="crud"/>
|
|
<property name="name" value="${Name}"/>
|
|
<property name="version" value="4.0"/>
|
|
|
|
<!-- project workspace directories -->
|
|
<property name="java.dir" value="src/main/java"/>
|
|
<property name="resources.dir" value="src/main/resources"/>
|
|
<property name="lib.dir" value="lib"/>
|
|
<property name="classes.dir" value="target/classes"/>
|
|
|
|
<!--
|
|
===================================================================
|
|
Classpath properties
|
|
===================================================================
|
|
-->
|
|
|
|
<!-- the classpath for running -->
|
|
<path id="run.classpath">
|
|
<fileset dir="${lib.dir}">
|
|
<include name="**/*.jar"/>
|
|
</fileset>
|
|
<pathelement location="${classes.dir}"/>
|
|
<pathelement location="${basedir}"/>
|
|
</path>
|
|
|
|
<!-- the classpath for the compile -->
|
|
<path id="compile.classpath">
|
|
<pathelement location="${classes.dir}"/>
|
|
<fileset dir="${lib.dir}">
|
|
<include name="**/*.jar"/>
|
|
</fileset>
|
|
<pathelement location="${classes.dir}"/>
|
|
<pathelement location="${basedir}"/>
|
|
</path>
|
|
|
|
<!--
|
|
===================================================================
|
|
TARGET : clean
|
|
===================================================================
|
|
-->
|
|
<target name="clean">
|
|
<delete includeEmptyDirs="true" quiet="true">
|
|
<fileset dir="${basedir}/target"/>
|
|
</delete>
|
|
</target>
|
|
|
|
<!--
|
|
===================================================================
|
|
TARGET : prepare
|
|
===================================================================
|
|
-->
|
|
<target name="prepare">
|
|
<mkdir dir="${classes.dir}"/>
|
|
</target>
|
|
|
|
<!--
|
|
===================================================================
|
|
TARGET : compile.java
|
|
===================================================================
|
|
-->
|
|
<target name="compile" depends="clean,prepare">
|
|
<echo message="==================================================================="/>
|
|
<echo message="Compile configuration:"/>
|
|
<echo message="java.dir = ${java.dir}"/>
|
|
<echo message="classes.dir = ${classes.dir}"/>
|
|
<echo message="==================================================================="/>
|
|
<javac srcdir="${java.dir}" destdir="${classes.dir}" debug="${project.build.debug}" classpathref="compile.classpath">
|
|
<include name="**/*.java"/>
|
|
</javac>
|
|
</target>
|
|
|
|
<!--
|
|
===================================================================
|
|
TARGET : copy metadata files
|
|
===================================================================
|
|
-->
|
|
<target name="copy.metadata">
|
|
<copy todir="${classes.dir}">
|
|
<fileset dir="${resources.dir}" includes="**/*.xml"/>
|
|
</copy>
|
|
</target>
|
|
|
|
<!--
|
|
===================================================================
|
|
TARGET : enhance
|
|
===================================================================
|
|
-->
|
|
<target name="enhance" depends="compile,copy.metadata">
|
|
|
|
<!-- define the task enhancer -->
|
|
<taskdef name="enhancer" classname="org.datanucleus.enhancer.EnhancerTask">
|
|
<classpath refid="run.classpath"/>
|
|
</taskdef>
|
|
|
|
<!-- enhance -->
|
|
<enhancer classpathref="run.classpath" dir="${classes.dir}" verbose="true" api="JPA" persistenceUnit="crud">
|
|
<sysproperty key="log4j.configuration" value="file:log4j.xml"/>
|
|
</enhancer>
|
|
</target>
|
|
|
|
<!-- SchemaTool "create" -->
|
|
<target name="createschema">
|
|
<taskdef name="schematool" classname="org.datanucleus.store.schema.SchemaToolTask">
|
|
<classpath refid="run.classpath"/>
|
|
</taskdef>
|
|
|
|
<schematool classpathref="run.classpath" failonerror="true" verbose="true"
|
|
mode="create" api="JPA" persistenceUnit="crud">
|
|
<sysproperty key="log4j.configuration" value="file:${basedir}/log4j.xml"/>
|
|
</schematool>
|
|
</target>
|
|
|
|
<!-- SchemaTool "delete" -->
|
|
<target name="deleteschema">
|
|
<taskdef name="schematool" classname="org.datanucleus.store.schema.SchemaToolTask">
|
|
<classpath refid="run.classpath"/>
|
|
</taskdef>
|
|
|
|
<schematool classpathref="run.classpath" failonerror="true" fork="true" verbose="true"
|
|
mode="delete" api="JPA" persistenceUnit="crud">
|
|
<sysproperty key="log4j.configuration" value="file:${basedir}/log4j.xml"/>
|
|
</schematool>
|
|
</target>
|
|
|
|
<!-- SchemaTool "dbinfo" -->
|
|
<target name="schemainfo">
|
|
<taskdef name="schematool" classname="org.datanucleus.store.schema.SchemaToolTask">
|
|
<classpath refid="run.classpath"/>
|
|
</taskdef>
|
|
|
|
<schematool classpathref="run.classpath" failonerror="true" fork="true" verbose="true"
|
|
mode="dbinfo" api="JPA" persistenceUnit="crud">
|
|
<sysproperty key="log4j.configuration" value="file:${basedir}/log4j.xml"/>
|
|
</schematool>
|
|
</target>
|
|
|
|
<!-- Run the application -->
|
|
<target name="run" description="Run the application">
|
|
<copy file="log4j.properties"
|
|
tofile="${classes.dir}/log4j.properties"/>
|
|
<java classname="com.example.crud.Main" classpathref="run.classpath" fork="true"/>
|
|
</target>
|
|
</project>
|