Monday, 4 May 2009

10-How to Develop Bean-Managed-Persistence Entity Beans

FILE:build.xml
<?xml version="1.0" encoding="ISO-8859-1"?>
<project name="EJB3 Tutorial" basedir="." default="deploy">

<property name="deploy.dir" value="C:/BMPentity/deploy" />
<property name="sourcedir" value="${basedir}/src"/>
<property name="targetdir" value="${basedir}/build"/>
<property name="librarydir" value="${basedir}/lib"/>

<path id="libraries">
<fileset dir="${librarydir}">
<include name="*.jar"/>
</fileset>
</path>

<target name="clean">
<delete dir="${targetdir}"/>
<mkdir dir="${targetdir}"/>
</target>

<target name="compile" depends="copy-resources">
<javac srcdir="${sourcedir}"
destdir="${targetdir}"
classpathref="libraries"
debug="on">

</javac>
</target>
<target name="copy-resources">
<copy todir="${targetdir}">
<fileset dir="${sourcedir}">
<exclude name="**/*.java"/>
</fileset>
</copy>
</target>

<target name="deploy" description="JARs the Task" depends="clean,copy-resources,compile">
<jar destfile="${deploy.dir}/BMPent.jar">
<metainf dir="${sourcedir}/META-INF" />
<fileset dir="${targetdir}">
<include name="**/*.class" />
</fileset>
</jar>
</target>

<target name="undeploy" description="Undeploy jar from server">
<delete file="${deploy.dir}/BMPent.jar" />
</target>

<target name="run" depends="compile">
<java classname="Client" classpathref="libraries">
<classpath path="${targetdir}"/>
<jvmarg value="-Djava.library.path=./lib"/>
</java>
</target>
</project>