ant example

<?xml version="1.0" encoding="UTF-8"?>
<project name="muHNWWeb" default="install" basedir=".">
 <property name="appname" value="muHNWWeb" />
 <property name="install.dir" value="install" />
 <property name="install.dir.backup" value="${install.dir}/backup" />
 <property name="install.dir.src" value="${install.dir}/src" />
 <property name="install.dir.classes" value="${install.dir}/classes" />
 <property name="install.dir.bin" value="${install.dir}/bin" />
 <property name="install.dir.properties" value="${install.dir}/properties" />
 <property name="install.dir.conf" value="${install.dir}/conf" />
 <property name="install.dir.lib" value="${install.dir}/lib" />
 <property name="install.dir.war" value="${install.dir}/war" />
 <property name="install.dir.preinstall" value="${install.dir}/preinstall" />
 <property name="install.dir.postinstall" value="${install.dir}/postinstall" />
 <property name="app_id" value="1211" />
 <property name="hermes.file" value="${appname}.tar" />
 <property environment="env" />
 <path id="build.path">
  <fileset dir="${install.dir.lib}">
   <include name="**/*.jar" />
  </fileset>
 </path>

 <target name="hermes" depends="package">
  <record name="logfile.txt" action="start" append="false" />
  <exec executable="/xenv/scripts/bin/send_to_hermes" dir="${basedir}">
   <arg value="${hermes.file}" />
  </exec>
  <record name="logfile.txt" action="stop" />
 </target>

 <target name="package" depends="copyall">
  <tar destfile="${basedir}/${hermes.file}" basedir="${basedir}/${install.dir}" />
 </target>

 <target name="copyall" depends="prepare,copyroot,copywebxml,copyconf,copybin,copyproperties,copylib,copysrclocal,copypreinstall,copypostinstall,dos2unix" />

 <target name="copydependencies" depends="prepare,copyroot,copyconf,copybin,copyproperties,copylib,copyXenvLib,copysrc,copypreinstall,copypostinstall,dos2unix" />

 <target name="copylocaldependencies" depends="prepare,copyroot,copyconf,copywebxml,copybin,copyproperties,copylib,copyXenvLib,copysrclocal,copypreinstall,copypostinstall,dos2unix" />

 <target name="install" depends="copydependencies">
  <move todir="${install.dir.lib}" includeemptydirs="false">
   <fileset dir="${install.dir.lib}" />
   <mapper type="glob" from="*.gif" to="*.jar" />
  </move>

  <javac srcdir="${basedir}/src" destdir="${install.dir.classes}" includeantruntime="false" nowarn="true" fork="true" memoryinitialsize="128m" memorymaximumsize="512m" verbose="false">
   <classpath>
    <path refid="build.path" />
   </classpath>
  </javac>

  <copy todir="${install.dir.classes}">
   <fileset dir="${basedir}/src" includes="**/*.xml" />
   <fileset dir="${basedir}/src" includes="**/*.properties" />
   <fileset dir="${basedir}/src" includes="**/*.css" />
   <fileset dir="${basedir}/conf" includes="**/*.xml" />
  </copy>

  <war destfile="${install.dir.war}/hnw.war" webxml="${basedir}/backup/web.xml">
   <fileset dir="${install.dir}">
    <exclude name="WEB-INF/" />
    <exclude name="classes/" />
    <exclude name="lib/" />
    <exclude name="war/" />
    <exclude name="backup/" />
   </fileset>
   <lib dir="${install.dir.lib}">
    <include name="**/*.jar" />
   </lib>
   <webinf dir="${basedir}/WEB-INF" includes="**/*.*">
   </webinf>
   <classes dir="${install.dir.classes}" />
  </war>

  <chmod file="${basedir}/preinstall/preinstall.ksh" perm="a+x" />
  <chmod file="${basedir}/postinstall/postinstall.ksh" perm="a+x" />
  <chmod file="${install.dir.preinstall}/preinstall.ksh" perm="a+x" />
  <chmod file="${install.dir.postinstall}/postinstall.ksh" perm="a+x" />
 </target>

 <target name="installlocal" depends="copylocaldependencies">
  <move todir="${install.dir.lib}" includeemptydirs="false">
   <fileset dir="${install.dir.lib}" />
   <mapper type="glob" from="*.gif" to="*.jar" />
  </move>

  <javac srcdir="${install.dir.src}" destdir="${install.dir.classes}" includeantruntime="false" nowarn="true" fork="true" memoryinitialsize="128m" memorymaximumsize="512m" verbose="false">
   <classpath>
    <path refid="build.path" />
   </classpath>
  </javac>

  <copy todir="${install.dir.classes}">
   <fileset dir="${install.dir.src}" includes="**/*.xml" />
   <fileset dir="${install.dir.src}" includes="**/*.properties" />
   <fileset dir="${install.dir.src}" includes="**/*.css" />
  </copy>

  <war destfile="${install.dir.war}/hnw.war" webxml="${install.dir.backup}/web.xml">
   <fileset dir="${install.dir}">
    <include name="**/*.*" />
    <exclude name="WEB-INF/" />
    <exclude name="classes/" />
    <exclude name="lib/" />
    <exclude name="war/" />
    <exclude name="backup/" />
   </fileset>
   <lib dir="${install.dir.lib}">
    <include name="**/*.jar" />
   </lib>
   <webinf dir="${install.dir}/WEB-INF" includes="**/*.*">
   </webinf>
   <classes dir="${install.dir.classes}" />
  </war>
 </target>

 <target name="prepare" depends="all">
  <mkdir dir="${install.dir}" />
  <mkdir dir="${install.dir.bin}" />
  <mkdir dir="${install.dir.classes}" />
  <mkdir dir="${install.dir.backup}" />
  <mkdir dir="${install.dir.properties}" />
  <mkdir dir="${install.dir.src}" />
  <mkdir dir="${install.dir.lib}" />
  <mkdir dir="${install.dir.war}" />
  <mkdir dir="${install.dir.conf}" />
  <mkdir dir="${install.dir.preinstall}" />
  <mkdir dir="${install.dir.postinstall}" />
 </target>

 <target name="copyroot">
  <copy todir="${install.dir}">
   <fileset dir="${basedir}">
    <include name="**/build.xml" />
    <include name="**/*.mk" />
    <include name="**/weblogic.policy" />
    <include name="**/config-template.*" />
   </fileset>
  </copy>
 </target>

 <target name="copywebxml">
  <copy file="${basedir}/src/hnw/WEB-INF/web.xml" todir="${install.dir.backup}" />
 </target>

 <target name="copyproperties">
  <copy todir="${install.dir.properties}">
   <fileset dir="${basedir}/properties">
    <include name="**/*.*" />
   </fileset>
  </copy>
 </target>

 <target name="copyconf">
  <copy todir="${install.dir.conf}">
   <fileset dir="${basedir}/conf">
    <include name="**/*.*" />
   </fileset>
  </copy>
 </target>

 <target name="copybin">
  <copy todir="${install.dir.bin}">
   <fileset dir="${basedir}/bin">
    <exclude name="**/startWebLogic.ksh.bk" />
   </fileset>
  </copy>
 </target>

 <target name="copysrclocal">
  <copy todir="${install.dir.src}">
   <fileset dir="${basedir}/src/hnw/src">
    <include name="**/*.java" />
    <include name="**/*.xml" />
    <include name="**/*.properties" />
    <include name="**/*.css" />
   </fileset>
  </copy>
  <copy todir="${install.dir}">
   <fileset dir="${basedir}/src/hnw">
    <include name="**/*.*" />
    <exclude name="**/*.pdf" />
    <exclude name="src/*.*" />
    <exclude name="sql/*.*" />
    <exclude name="WEB-INF/web.xml.dev" />
    <exclude name="WEB-INF/web.xml.prod" />
    <exclude name="**/build.xml.bk" />
   </fileset>
  </copy>
  <copy todir="${install.dir.backup}">
   <fileset dir="${basedir}/src/hnw">
    <include name="**/*.*" />
    <exclude name="**/*.pdf" />
    <exclude name="src/*.*" />
    <exclude name="sql/*.*" />
    <exclude name="WEB-INF/web.xml.dev" />
    <exclude name="WEB-INF/web.xml.prod" />
    <exclude name="**/build.xml.bk" />
   </fileset>
  </copy>
 </target>

 <target name="copysrc">
  <copy todir="${install.dir.src}">
   <fileset dir="${basedir}/src" />
  </copy>
  <copy todir="${install.dir}">
   <fileset dir="${basedir}/backup">
    <exclude name="WEB-INF/*.*" />
   </fileset>
  </copy>
 </target>

 <target name="copyXenvLib">
  <copy todir="${install.dir.lib}">
   <fileset dir="/xenv/spring-framework/X/2.5.1/lib/j2ee">
    <include name="**/activation.jar" />
    <include name="**/servlet-api.jar" />
    <include name="**/jta.jar" />
   </fileset>
   <fileset dir="/xenv/spring-framework/X/2.5.1/lib/ant">
    <include name="**/ant.jar" />
    <include name="**/ant-junit.jar" />
    <include name="**/ant-launcher.jar" />
    <include name="**/ant-trax.jar" />
   </fileset>
   <fileset dir="/xenv/spring-framework/X/2.5.1/lib/antlr">
    <include name="**/antlr-2.7.6.jar" />
   </fileset>
   <fileset dir="/xenv/spring-framework/X/2.5.1/lib/asm">
    <include name="**/asm-2.2.3.jar" />
    <include name="**/asm-commons-2.2.3.jar" />
    <include name="**/asm-util-2.2.3.jar" />
   </fileset>
   <fileset dir="/xenv/spring-framework/X/2.5.1/lib/axis">
    <include name="**/axis.jar" />
    <include name="**/wsdl4j.jar" />
   </fileset>
   <fileset dir="/xenv/spring-framework/X/2.5.1/lib/jakarta-taglibs">
    <include name="**/standard.jar" />
   </fileset>
   <fileset dir="/xenv/spring-framework/X/2.5.1/lib/cglib">
    <include name="**/cglib-nodep-2.1_3.jar" />
   </fileset>
   <fileset dir="/xenv/spring-framework/X/2.5.1/lib/dom4j">
    <include name="**/dom4j-1.6.1.jar" />
   </fileset>
   <fileset dir="/xenv/spring-framework/X/2.5.1/lib/ehcache">
    <include name="**/ehcache-1.3.0.jar" />
   </fileset>
   <fileset dir="/xenv/hibernate/X/3.2.1">
    <include name="**/hibernate3.jar" />
   </fileset>
   <fileset dir="/xenv/spring-framework/X/2.5.1/lib/itext">
    <include name="**/iText-2.0.7.jar" />
   </fileset>
   <fileset dir="/xenv/spring-framework/X/2.5.1/lib/junit">
    <include name="**/junit-4.4.jar" />
   </fileset>
   <fileset dir="/xenv/jstl/X/1.1.2/lib">
    <include name="**/jstl.jar" />
   </fileset>
   <fileset dir="/xenv/log4j/X/1.2.16">
    <include name="**/log4j-1.2.16.jar" />
   </fileset>
   <fileset dir="/xenv/JSIL-Security/X/3.0_E0/lib">
    <include name="**/security.jar" />
   </fileset>
   <fileset dir="/xenv/JSIL-JLOG/X/2.0_C0/lib">
    <include name="**/jlog.jar" />
   </fileset>
   <fileset dir="/xenv/JSIL-DCP/X/3.1_C0/lib">
    <include name="**/connectionpooling.jar" />
   </fileset>
   <fileset dir="/xenv/spring-framework/X/2.0.3/dist">
    <include name="**/spring.jar" />
   </fileset>
   <fileset dir="/xenv/struts/X/1.2.9/lib">
    <include name="**/struts.jar" />
   </fileset>
   <fileset dir="/xenv/cewolf/X/1.0/lib">
    <include name="**/cewolf-1.0.jar" />
   </fileset>
   <fileset dir="/xenv/DWR/X/2.0.3">
    <include name="**/dwr.jar" />
   </fileset>
   <fileset dir="/xenv/BondInventorySearch/X/1.0_A0/lib">
    <include name="**/queryServiceClient.jar" />
   </fileset>
   <fileset dir="/xenv/muHNWSpt/X/1.1_B36/lib">
    <include name="**/*.jar" />
   </fileset>
   <fileset dir="/xenv/muYBCalc/X/1.1_B93/lib">
    <include name="**/muYBCalc.jar" />
   </fileset>
   <fileset dir="/xenv/muMktUtl/X/2.1_C0/lib">
    <include name="**/muMktUtl.jar" />
   </fileset>
   <fileset dir="/xenv/MuSvrOFM/X/2.3_G0/lib">
    <include name="**/MuSvrOFM_clientProxy.jar" />
   </fileset>
   <fileset dir="/xenv/OrderBackportUtilConcurrent/X/2.2_A1/lib">
    <include name="**/backport-util-concurrent.jar" />
   </fileset>
   <fileset dir="/xenv/pcreate_pkg/X/4.0_E0/classes">
    <include name="**/pcreate.jar" />
   </fileset>
   <fileset dir="/xenv/reosupport/X/1.0_A52/lib">
    <include name="**/muReoBWeb.jar" />
    <include name="**/clientcache.jar" />
   </fileset>
   <fileset dir="/xenv/jfreechart/X/1.0.0/lib">
    <include name="**/jfreechart-1.0.0.jar" />
    <include name="**/jcommon-1.0.0.jar" />
   </fileset>
  </copy>
 </target>

 <target name="copylib">
  <copy todir="${install.dir.lib}">
   <fileset dir="${basedir}/lib">
    <include name="**/*.gif" />
   </fileset>
  </copy>
 </target>

 <target name="copypreinstall">
  <copy todir="${install.dir.preinstall}">
   <fileset dir="${basedir}/preinstall" />
  </copy>
  <chmod file="${install.dir.preinstall}/preinstall.ksh" perm="a+x" />
 </target>

 <target name="copypostinstall">
  <copy todir="${install.dir.postinstall}">
   <fileset dir="${basedir}/postinstall" />
  </copy>
  <chmod file="${install.dir.postinstall}/postinstall.ksh" perm="a+x" />
 </target>

 <target name="dos2unix" depends="all">
  <echo message="Start Fixing dos2unix" />
  <echo message="${install.dir}" />
  <fixcrlf srcdir="${install.dir.bin}" includes="**" eol="lf" eof="remove" />
  <fixcrlf srcdir="${install.dir.postinstall}" includes="*.ksh" eol="lf" eof="remove" />
  <fixcrlf srcdir="${install.dir.preinstall}" includes="*.ksh" eol="lf" eof="remove" />
  <echo message="End" />
 </target>

 <target name="all" depends="clean" />

 <target name="clean">
  <echo message="Main clean ${basedir}" />
  <delete dir="${hermes.file}" />
  <delete dir="${install.dir}" />
  <delete file="${hermes.file}" />
 </target>

 <target name="help">
  <echo message="hostname = ${env.HOSTNAME}" />
  <echo message="basedir = ${basedir}" />
  <echo message="install.dir = ${install.dir}" />
  <echo message="hermes --  Post tar file to Hermes Server For Pre-Release" />
  <echo message="package -- Generate tar file based on install folder" />
  <echo message="copyall -- Invoke prepare and copying actions" />
  <echo message="copydependencies -- Invoke prepare and copying actions" />
  <echo message="copylocaldependencies -- Invoke prepare and copying action" />
  <echo message="install -- Generate war file for deployment in DEV, STG and PROD and place it in war folder under ${basedir}" />
  <echo message="installlocal -- Generate war file for deployment in local and place it in war folder under ${install.dir}" />
  <echo message="prepare -- Create install folder and its sub folders. It is the dependence for install, installlocal and package." />
  <echo message="copyroot -- Copy source files under ${basedir} to ${install.dir}. It is the dependence for install, installlocal and package." />
  <echo message="copywebxml -- Copy web.xml to backup folder under ${basedir}. It is the dependence for installlocal and package." />
  <echo message="copyproperties -- Copy properties folder under ${basedir} to ${install.dir}. It is the dependence for install, installlocal and package." />
  <echo message="copyconf -- Copy conf folder under ${basedir} to ${install.dir}. It is the dependence for install, installlocal and package." />
  <echo message="copybin -- Copy bin folder under ${basedir} to ${install.dir}. It is the dependence for install, installlocal and package." />
  <echo message="copysrclocal -- Copy source files from src folder to ${install.dir} and backup folder under ${basedir}. It is the dependence for installlocal and package." />
  <echo message="copysrc -- Copy source files from src folder and backup folder under ${basedir} to ${install.dir}. It is the dependence for install." />
  <echo message="copyXenvLib -- Retrieve dependencies from Xenv to ${install.dir.lib}" />
  <echo message="copylib -- Copy lib folder under ${basedir} to ${install.dir}" />
  <echo message="copypreinstall -- Copy preinstall folder under ${basedir} to ${install.dir}" />
  <echo message="copypostinstall -- Copy postinstall folder under ${basedir} to ${install.dir}" />
  <echo message="dos2unix --  Perform dos2unix" />
  <echo message="all --  Invoke clean. It is the dependence for prepare." />
  <echo message="clean -- Remove install directory, tar file and paudit directory" />
 </target>
</project>

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值