<?xml version="1.0"?>
<project name="Cash Management System - BackOffice - Ant build script" default="all_for_deploy-nowar" basedir="../../">
<target name="init">
<property file="scripts/ant/build.properties"/>
<tstamp>
<format property="TODAY" pattern="dd-MMM-yy"/>
</tstamp>
<!-- Classpath for weblogic.ejbc -->
<path id="ejbc.classpath">
<fileset dir="${weblogic.lib.dir}">
<include name="weblogic.jar"/>
</fileset>
<fileset dir="${java.lib.dir}">
<include name="*.jar"/>
</fileset>
<fileset dir="${lib.dir}">
<include name="*.jar"/>
</fileset>
<fileset dir="${lib.ext.dir}">
<include name="*.jar"/>
</fileset>
<fileset dir="${lib.ext.xdoclet}">
<include name="*.jar"/>
</fileset>
</path>
<!-- Classpath for webapp compilation -->
<path id="webapp.classpath">
<fileset dir="${lib.dir}">
<include name="*.jar"/>
</fileset>
<fileset dir="${lib.ext.dir}">
<include name="*.jar"/>
</fileset>
<fileset dir="${webapp.dir}/WEB-INF/lib">
<include name="*.jar"/>
</fileset>
<fileset dir="${weblogic.lib.dir}">
<include name="weblogic.jar"/>
</fileset>
</path>
<!-- List of java to compile -->
<patternset id="java.to.compile">
<includesfile name="scripts/ant/src-java.txt"/>
</patternset>
<!-- List of EJB to generate interfaces -->
<patternset id="ejb.to.generate.interface">
<includesfile name="scripts/ant/src-ejb.txt"/>
</patternset>
<!-- List of EJB to compile -->
<patternset id="ejb.to.compile">
<includesfile name="scripts/ant/src-ejb.txt"/>
</patternset>
</target>
<target name="prepare" depends="init">
<!-- <mkdir dir="${javadoc.dir}"/>-->
<mkdir dir="${build.dir}" />
<mkdir dir="${ejb.compiled.classes.base.dir}" />
<mkdir dir="${deployment.descriptor.dir}" />
<mkdir dir="${dist.dir}" />
</target>
<!-- Generate interfaces for EJB -->
<target name="ejbdoclet" depends="prepare">
<taskdef name="ejbdoclet"
classname="xdoclet.modules.ejb.EjbDocletTask"
classpathref="ejbc.classpath" />
<ejbdoclet
destdir="${src.dir}"
excludedtags="@version,@author"
ejbspec="2.0"
force="${xdoclet.force}">
<fileset dir="${src.dir}">
<patternset refid="ejb.to.generate.interface" />
</fileset>
<remoteinterface/>
<homeinterface/>
<localinterface pattern="{0}Local" />
<localhomeinterface pattern="{0}LocalHome" />
<deploymentdescriptor destdir="${deployment.descriptor.dir}"
mergedir="${src.dir}" />
<weblogic xmlencoding="UTF-8"
destdir="${deployment.descriptor.dir}"
validatexml="true" version="7.0"/>
</ejbdoclet>
</target>
<!-- Compile Java files -->
<target name="compile-java" depends="prepare">
<depend srcdir="${src.dir}"
destdir="${ejb.compiled.classes.base.dir}"
closure="no" />
<javac srcdir="${src.dir}"
destdir="${ejb.compiled.classes.base.dir}"
classpathref="ejbc.classpath"
excludes="**/testcase/**"
debug="false">
<includesfile name="scripts/ant/src-java.txt" />
</javac>
</target>
<!-- Compile webapp java files -->
<target name="compile-webapp" depends="prepare">
<depend srcdir="${src.dir}"
destdir="${webapp.dir}/WEB-INF/classes/"
closure="no" />
<javac srcdir="${src.dir}"
destdir="${webapp.dir}/WEB-INF/classes/"
classpathref="webapp.classpath"
debug="false">
<!--
excludes="**/ejb/** **/vo/** **/mapper/** **/delegate/** **/helper/**"
-->
<includesfile name="scripts/ant/src-web.txt" />
</javac>
</target>
<!-- Compile EJB files -->
<target name="compile-ejb" depends="prepare">
<depend srcdir="${src.dir}"
destdir="${ejb.compiled.classes.base.dir}"
closure="no" />
<javac srcdir="${src.dir}"
destdir="${ejb.compiled.classes.base.dir}"
classpathref="ejbc.classpath"
debug="false">
<includesfile name="scripts/ant/src-ejb.txt" />
</javac>
</target>
<!-- Create jar file -->
<target name="ejb-jar" depends="compile-ejb">
<copy todir="${build.dir}/ejb/META-INF">
<fileset dir="${deployment.descriptor.dir}">
<include name="ejb-jar.xml"/>
<include name="weblogic-ejb-jar.xml"/>
</fileset>
</copy>
<jar destfile="${dist.dir}/${ejb.jar.name}"
basedir="${ejb.compiled.classes.base.dir}"
manifest="${eai.meta.file}">
<fileset dir="${ejb.compiled.classes.base.dir}">
<patternset>
<exclude name="**/web/**"/>
</patternset>
</fileset>
</jar>
</target>
<!-- Run weblogic.ejbc on EJB jar file -->
<target name="ejbc" depends="ejb-jar" >
<java classname="weblogic.ejbc" fork="yes" classpathref="ejbc.classpath">
<arg line="${build.dir}/${ejb.jar.name} ${dist.dir}/${ejb.jar.name}"/>
</java>
<delete file="${build.dir}/${ejb.jar.name}"/>
</target>
<!-- Prepare ejb client jar for webapp -->
<target name="ejb-client-jar" depends="compile-ejb" >
<jar jarfile="${dist.dir}/${ejb.client.jar.name}" update="true" >
<fileset dir="${ejb.compiled.classes.base.dir}">
<patternset>
<exclude name="**/ejb/*EJB.class"/>
<exclude name="**/web/**/*.class"/>
<exclude name="**/vo/**/*.class"/>
<include name="**/ejb/**" />
<include name="**/exception/**" />
<include name="**/helper/**" />
<include name="**/delegate/**" />
<include name="**/metadata/**" />
</patternset>
</fileset>
</jar>
<copy file="${dist.dir}/${ejb.client.jar.name}" todir="${webapp.dir}/WEB-INF/lib"/>
</target>
<target name="vo-jar" depends="compile-java" >
<jar jarfile="${dist.dir}/${vo.jar.name}" update="true" >
<fileset dir="${ejb.compiled.classes.base.dir}">
<patternset>
<include name="**/vo/**" />
<include name="**/mapper/**" />
</patternset>
</fileset>
</jar>
<copy file="${dist.dir}/${vo.jar.name}" todir="${webapp.dir}/WEB-INF/lib"/>
</target>
<!-- Prepare ejb client jar for webapp -->
<target name="web-war" depends="compile-webapp" >
<jar jarfile="${dist.dir}/${web.war.name}"
update="false" >
<fileset dir="${webapp.dir}">
<patternset>
<include name="**/**" />
</patternset>
</fileset>
</jar>
<copy file="${dist.dir}/${ejb.client.jar.name}" todir="${webapp.dir}/WEB-INF/lib"/>
</target>
<target name="copy-client-jar-to-webapp" depends="prepare">
<!--
<copy todir="${webapp.dir}/WEB-INF/lib">
<fileset dir="${lib.dir}">
<patternset>
<includesfile name="scripts/ant/src-web-lib.txt" />
</patternset>
</fileset>
</copy>
-->
</target>
<target name="app-ear" depends="prepare">
<ear appxml="${deployment.descriptor.dir}/application.xml"
destfile="${dist.dir}/${eai.name}"
manifest="${eai.meta.file}">
<fileset dir="${dist.dir}" includes="*.jar *.war" excludes="${ejb.client.jar.name}"/>
<fileset dir="${lib.dir}">
<patternset>
<!-- ebkernel and its dependent jar -->
<include name="*.jar" />
</patternset>
</fileset>
<fileset dir="${lib.dir}/ext">
<patternset>
<!-- ebkernel and its dependent jar -->
<include name="jboss_full.jar" />
<include name="jdom_full.jar" />
<include name="log4j-1.2.8.jar" />
<include name="services.jar" />
<include name="xercesImpl.jar" />
<include name="icu4j_3_4.jar"/>
<include name="jstl.jar" />
<include name="struts.jar" />
<include name="struts-el.jar" />
<include name="commons-logging.jar" />
<include name="commons-validator.jar" />
<include name="commons-beanutils.jar" />
<include name="commons-fileupload.jar" />
<include name="commons-digester.jar" />
<include name="standard.jar" />
<include name="castor-0.9.7-xml.jar" />
<include name="VAAdminAPI.jar" />
<include name="VAAgentAPI.jar" />
<include name="VCrypto.jar" />
<include name="VLogger.jar" />
<include name="bcpg-jdk14-133.jar" />
<include name="bcprov-jdk14-133.jar" />
<include name="jakarta-regexp-1.3.jar" />
<include name="j2ee.jar" />
<include name="jce.jar" />
</patternset>
</fileset>
</ear>
</target>
<!--ear the application without war-->
<target name="app-ear-nowar" depends="prepare">
<ear appxml="${deployment.descriptor.dir}/application_nowar.xml"
destfile="${dist.dir}/${eai.name}"
manifest="${eai.meta.file}">
<fileset dir="${dist.dir}" includes="*.jar" excludes="${ejb.client.jar.name}"/>
<fileset dir="${lib.dir}">
<patternset>
<!-- ebkernel and its dependent jar -->
<include name="*.jar" />
</patternset>
</fileset>
<fileset dir="${lib.dir}/ext">
<patternset>
<!-- ebkernel and its dependent jar -->
<include name="jboss_full.jar" />
<include name="jdom_full.jar" />
<include name="log4j-1.2.8.jar" />
<include name="services.jar" />
<include name="xercesImpl.jar" />
<include name="icu4j_3_4.jar"/>
<include name="jstl.jar" />
<include name="struts.jar" />
<include name="struts-el.jar" />
<include name="commons-logging.jar" />
<include name="commons-validator.jar" />
<include name="commons-beanutils.jar" />
<include name="commons-fileupload.jar" />
<include name="commons-digester.jar" />
<include name="standard.jar" />
<include name="castor-0.9.7-xml.jar" />
<include name="VAAdminAPI.jar" />
<include name="VAAgentAPI.jar" />
<include name="VCrypto.jar" />
<include name="VLogger.jar" />
<include name="bcpg-jdk14-133.jar" />
<include name="bcprov-jdk14-133.jar" />
<include name="jakarta-regexp-1.3.jar" />
<include name="j2ee.jar" />
<include name="jce.jar" />
</patternset>
</fileset>
</ear>
</target>
<!-- deploy ejb jar -->
<target name="deploy-ear" depends="app-ear">
<copy file="${dist.dir}/${eai.name}" todir="${weblogic.deploy.dir}"/>
</target>
<target name="clean" depends="init">
<delete>
<fileset dir="${dist.dir}">
<exclude name="ebkernel-ejb.jar"/>
</fileset>
</delete>
<delete>
<fileset dir="${deployment.descriptor.dir}">
<include name="ejb-jar.xml"/>
<include name="weblogic-ejb-jar.xml"/>
</fileset>
</delete>
<delete>
<fileset dir="${webapp.dir}">
<include name="/WEB-INF/lib/**" />
<include name="/WEB-INF/classes/**"/>
</fileset>
</delete>
</target>
<!-- Perform all tasks in script -->
<target name="all" depends="init,prepare,ejbdoclet,compile-java,compile-ejb,compile-webapp,vo-jar,ejb-client-jar,ejb-jar,copy-client-jar-to-webapp,web-war,app-ear,deploy-ear">
<echo message="system built" />
</target>
<target name="all_for_deploy" depends="init,clean,prepare,ejbdoclet,compile-java,compile-ejb,compile-webapp,vo-jar,ejb-jar,ejb-client-jar,copy-client-jar-to-webapp,web-war,app-ear,deploy-ear">
<echo message="system built" />
</target>
<!-- deploy ejb jar no war -->
<target name="deploy-ear-nowar" depends="app-ear-nowar">
<copy file="${dist.dir}/${eai.name}" todir="${weblogic.deploy.dir}"/>
</target>
<target name="all_for_deploy-nowar" depends="init,clean,prepare,ejbdoclet,compile-java,compile-ejb,vo-jar,ejb-jar,ejb-client-jar,app-ear-nowar,deploy-ear-nowar">
<echo message="system deployed" />
</target>
</project>