zoukankan      html  css  js  c++  java
  • ant 打war包

    <?xml version="1.0" ?>
    <project name="hp" default="war">
     <property name="src" value="src" />
     <property name="WebContent" value="WebContent" />
     <property name="dist" value="dist" />
     <property name="warDest" value="wardest" />
     <property name="classDest" value="class" />
     <property name="source-encoding" value="UTF-8" />
     <property name="tomcat-lib" value="d:/apache-tomcat-6.0.32/lib" />
     <property name="warName" value="ROOT.war"/>

     <!--编译java源文件所需的jar文件 -->
     <path id="build-classpath">
      <fileset dir="WebContent\WEB-INF\lib">
       <include name="*.jar" />
      </fileset>
      <fileset dir="${tomcat-lib}">
       <include name="*.jar" />
      </fileset>
     </path>
     
     <!--清理-->
     <target name="clean">
      <delete dir="${dist}" />
     </target>
     
     <!-- 初始化,建立相关的文件夹-->
     <target name="init">
      <mkdir dir="${dist}"/>
      <mkdir dir="${dist}/${warDest}" />
      <mkdir dir="${dist}/${classDest}" />
     </target>
     
     <!-- 编译java源文件并拷贝到相应的文件夹-->
     <target name="compile" depends="init">
      <javac srcdir="${src}" destdir="${dist}/${classDest}"  target="1.6"
       classpathref="build-classpath" encoding="${source-encoding}"
       debug="true" debuglevel="source,lines,vars">
      </javac>
     </target>
     
     <!--拷贝webcontent文件到相应的文件夹-->
     <target name="copy">
      <copy todir="${dist}/${warDest}">
       <fileset dir="${WebContent}">
        <exclude name="**/*.jar"/>
       </fileset>
      </copy>
      <copy todir="${dist}/${classDest}">
       <fileset dir="${src}">
        <exclude name="**/*.java"/>
       </fileset>
      </copy>
       
      <!--拷贝部署用的配置文件-->
      <delete file="${dist}/${warDest}/WEB-INF/config/log4j.properties"/>
      <move file="${dist}/${warDest}/WEB-INF/config/log4j.build.properties"
       tofile="${dist}/${warDest}/WEB-INF/config/log4j.properties" />
      <delete file="${dist}/${warDest}/WEB-INF/web.xml"/>
      <move file="${dist}/${warDest}/WEB-INF/web.build.xml"
       tofile="${dist}/${warDest}/WEB-INF/web.xml" />
      <delete file="${dist}/${warDest}/META-INF/context.xml"/>
       <move file="${dist}/${warDest}/META-INF/context.build.xml"
        tofile="${dist}/${warDest}/META-INF/context.xml" />
     </target>
     
     <!--打包-->
     <target name="war" depends="compile, copy">
      <war destfile="${dist}/${warName}" webxml="${WebContent}/WEB-INF/web.xml">
       <fileset dir="${dist}/${warDest}" />
       <!--
       <lib dir="${WebContent}/WEB-INF/lib"/>
       -->
       <classes dir="${dist}/${classDest}"></classes>
      </war>
      <delete dir="${dist}/${warDest}"></delete>
      <delete dir="${dist}/${classDest}"></delete>
     </target>
     
    </project>

  • 相关阅读:
    数组和切片
    if else,for循环,switch语句
    数据库介绍以及MySQL数据库的使用
    Django Rest Framwork的认证组件 权限组件以及频率组件
    Django Rest Frawwork框架的CBV FBV分析
    事务介绍
    celery介绍
    多道技术 进程 线程 协程 GIL锁 同步异步 高并发的解决方案 生产者消费者模型
    win10安装mysql8.0版本
    安装VMware Tools的注意事项
  • 原文地址:https://www.cnblogs.com/zhenmingliu/p/2355085.html
Copyright © 2011-2022 走看看