tomcat

xml 代码
 
  1. <project name="app" default="all" basedir=".">  
  2.   
  3.  <property file="${basedir}/build.properties" />  
  4.  <!-- set global properties for this build -->  
  5.  <property name="app.project.root" value="kmss_hr_pm" />  
  6.  <property name="app.project.name" value="kpi" />  
  7.  <property name="app.src"  
  8.   value="${app.project.name}/${app.project.root}/src" />  
  9.  <property name="app.web"  
  10.   value="${app.project.name}/${app.project.root}/WebContent" />  
  11.  <property name="build" value="${app.web}/WEB-INF/classes" />  
  12.  <property name="dist" value="dist" />  
  13.  <property name="cvsroot"  
  14.   value=":pserver:${cvs.user}:${cvs.password}@${cvs.server}:${cvs.repository}" />  
  15.   
  16.  <property name="main.dir" value="${app.project.name}" />  
  17.  <property name="main.cvs.repository.path"  
  18.   value="${app.project.root}" />  
  19.  <property name="tomcat.home"  
  20.   value="D:/Apache Software Foundation/Tomcat 5.0" />  
  21.  <!-- 
  22.   Initializing -->  
  23.  <target name="init">  
  24.   <tstamp>  
  25.    <format property="today" pattern="yyyy-MM-dd hh:mm:ss" />  
  26.   </tstamp>  
  27.   <echo message="${today}" />  
  28.    <echo message="*****************************************" />  
  29.    <echo message="         --应用程序自动发布--               " />  
  30.    <echo message="     系统将自动运行以下任务:            " />  
  31.    <echo message="     1.从cvs下载源代码                   " />  
  32.    <echo message="     2.编译下载的源代码                  " />  
  33.    <echo message="     3.停止tomcat程序运行                " />  
  34.    <echo message="     4.将编译好的应用程序打包            " />  
  35.    <echo message="     5.发布应用程序到tomcat应用服务器    " />  
  36.    <echo message="     6.启动tomcat应用服务器              " />  
  37.    <echo message="******************************************" />  
  38.    <sleep seconds="5"/>  
  39.  </target>  
  40.  <target name="all" depends="init,clean,main-check-out,compile,dist,deploy">  
  41.  </target>  
  42.  <!-- 捡出主干程序 -->  
  43.  <target name="main-check-out">  
  44.   <echo message="正在捡出程序..." />  
  45.   <cvs cvsRoot="${cvsroot}" package="${main.cvs.repository.path}"  
  46.    dest="${main.dir}" />  
  47.  </target>  
  48.   
  49.  <target name="compile">  
  50.   <!-- Compile the java code from ${src} into ${build} -->  
  51.   <echo message="正在编译应用程序..." />  
  52.   <delete dir="${build}" />  
  53.   <mkdir dir="${build}" />  
  54.   <echo message="build src:${app.src}\ndestdir:${build}" />  
  55.   <javac srcdir="${app.src}" destdir="${build}" encoding="UTF-8"  
  56.    source="1.4" fork="true" memoryMaximumSize="512M">  
  57.   
  58.    <classpath>  
  59.     <fileset dir="${basedir}">  
  60.      <include name="${app.web}/WEB-INF/lib/*.jar" />  
  61.      <include name="lib/*.jar" />  
  62.     </fileset>  
  63.     <pathelement path="${java.class.path}/" />  
  64.    </classpath>  
  65.   </javac>  
  66.   <copy toDir="${build}">  
  67.    <fileset dir="${app.src}"  
  68.     includes="**/*.properties,**/*.xml" />  
  69.   </copy>  
  70.  </target>  
  71.   
  72.  <target name="dist">  
  73.   <echo message="正在构建程序到${dist}目录..." />  
  74.   <mkdir dir="${dist}" />  
  75.   <copy todir="${dist}">  
  76.    <fileset dir="${app.web}" />  
  77.   </copy>  
  78.  </target>  
  79.   
  80.  <target name="clean">  
  81.   <echo message="正在清除${dist}中的历史构建..." />  
  82.   <delete dir="${dist}" />  
  83.   <delete dir="${app.project.root}" />  
  84.  </target>  
  85.  <target name="deploy"  
  86.   depends="stop-tomcat,delete-old-work,create-war-file,start-tomcat" >  
  87.   <echo message="发布应用程序完毕." />  
  88.  </target>  
  89.  <target name="start-tomcat">  
  90.   <echo message="正在启动tomcat..." />  
  91.   <exec dir="${tomcat.home}/bin"  
  92.    executable="${tomcat.home}/bin/startup.bat"  
  93.    spawn="true">  
  94.   </exec>  
  95.  </target>  
  96.  <target name="stop-tomcat">  
  97.   <echo message="正在停止tomcat..." />  
  98.   <exec dir="${tomcat.home}/bin"  
  99.    executable="${tomcat.home}/bin/shutdown.bat">  
  100.   </exec>  
  101.   <sleep seconds="6"/>  
  102.  </target>  
  103.  <target name="delete-old-work">  
  104.   <echo message="正在清除tomcat中的历史发布..." />  
  105.   <delete dir="${tomcat.home}/work/Catalina/localhost" failonerror="false"/>  
  106.   <delete dir="${tomcat.home}/webapps/kpi"  failonerror="false"/>  
  107.   <delete file="${tomcat.home}/webapps/kpi.war"  failonerror="false"/>  
  108.  </target>  
  109.  <target name="create-war-file">  
  110.   <echo message="正在打包应用程序..." />  
  111.   <war destfile="${tomcat.home}/webapps/kpi.war"  
  112.    basedir="${dist}" webxml="${dist}/WEB-INF/web.xml">  
  113.   </war>  
  114.  </target>  
  115. </project>  
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值