[Ant存档]改改就行了,省得老写

build.xml     >>>>>>>>> V20061129: DB Operation with ant <<<<<<<<<

<!-- Copyright (c) 2002 by ObjectLearn. All Rights Reserved. -->
<project name="ITSSystem"  default="deploy"  basedir=".">


  <!-- set global properties for this build -->
  <property file="build.properties"/>
  <property name="dist" value="../../dist" />
  <property name="its" value="../" />
  <property name="lib.dir" value="../WEB-INF/lib" />
  <property name="sql.dir" value="../sql" />

 
    <!-- Build classpath -->
    <path id="classpath">
        <fileset dir="${lib.dir}">
            <include name="**/*.jar"/>
            <exclude name="**/xalan*.jar"/>
        </fileset>
        <fileset dir="${ant.home}/lib">
            <include name="**/ant*.jar"/>
        </fileset>
    </path>
  
 
  <target name = "update"> 
    <delete file="${deploy.dir}/${war}.war" failonerror="false" />
 <copy todir="${deploy.dir}/${war}/WEB-INF/classes">
  <fileset dir="${basedir}/classes"></fileset>
 </copy>
 <copy todir="${deploy.dir}/${war}/${jsp.dir}">
  <fileset dir="${its}/${jsp.dir}"></fileset>
 </copy>
 <copy todir="${deploy.dir}/${war}/WEB-INF">
  <fileset file="${basedir}/struts-config.xml"/>
  <fileset file="${basedir}/web.xml"/>
 </copy>
   <copy todir="${deploy.dir}/${war}/style">
    <fileset dir="${its}/style"></fileset>
   </copy>
  </target>  
 
  <target name="init">
    <!-- Create the dist directory structure used by compile
         and copy the deployment descriptors into it-->
    <mkdir dir="${dist}"/>
   <mkdir dir="${dist}/pages"/>
    <mkdir dir="${dist}/WEB-INF"/>
    <mkdir dir="${dist}/WEB-INF/classes"/>
    <mkdir dir="${dist}/WEB-INF/lib"/>
    <copy todir="${dist}">
      <fileset dir="${its}">
        <include name="**/*.*"/>
        <exclude name="**/jsp_servlet/*.class"/>
        <exclude name="**/build.xml"/>
       <exclude name="**/build.properties"/>
       <exclude name="**/src/**"/>
       <exclude name="**/work/**"/>
       <exclude name=".classpath"/>
       <exclude name=".project"/>
       <exclude name=".tomcatplugin"/>
      </fileset>
    </copy>
<!--    <copy todir="${dist}/WEB-INF/classes">
      <fileset dir="${project.dir}/${bin.dir}">
        <include name="**/*.*"/>
        <exclude name="**/jsp_servlet/*.class"/>
      </fileset>
    </copy> 
-->   
  </target>


 
  <target name="deploy" depends="init" >
    <!-- Create the distribution directory -->
    <delete file="${war}.war" failonerror="false" />
   <delete dir="${deploy.dir}/${war}" failonerror="false"/>
<!-- <jar jarfile="${war}.war" basedir="${dist}"/>   
   <copy file="${war}.war" todir="${deploy.dir}"/>
    <delete file="${war}.war" failonerror="false" />
    -->
   <mkdir dir="${deploy.dir}/${war}"/>
   <copy todir="${deploy.dir}/${war}">
    <fileset dir="${dist}">
     <include name="**/*.*"/>
    </fileset>
   </copy>
    <delete dir="${dist}" failonerror="false" />
  </target>
 
  <target name="create-table">
   <sql driver="org.gjt.mm.mysql.Driver"
     url="jdbc:mysql://192.168.227.65:3306/its_dbtest"
     password="65"
     userid="aaron"
     src="${sql.dir}/create-table.sql">
    <classpath refid="classpath"/>
   </sql>
  </target>

</project>

>>>>>>>>> V20061129 end <<<<<<<<<

build.xml     >>>>>>>>>  打个war包copy到webapps下<<<<<<<<<

<!-- Copyright (c) 2002 by ObjectLearn. All Rights Reserved. -->
<project name="ITSSystem"  default="deploy"  basedir=".">


  <!-- set global properties for this build -->
  <property file="build.properties"/>
  <property name="dist" value="../../dist" />
  <property name="its" value="../" />
 
   <target name = "update"> 
    <delete file="${deploy.dir}/${war}.war" failonerror="false" />
 <copy todir="${deploy.dir}/${war}/WEB-INF/classes">
  <fileset dir="${basedir}/classes"></fileset>
 </copy>
 <copy todir="${deploy.dir}/${war}/${jsp.dir}">
  <fileset dir="${its}/${jsp.dir}"></fileset>
 </copy>
 <copy todir="${deploy.dir}/${war}/WEB-INF">
  <fileset file="${basedir}/struts-config.xml"></fileset>
 </copy>
  </target> 

 
  <target name="init">
    <!-- Create the dist directory structure used by compile
         and copy the deployment descriptors into it-->
    <mkdir dir="${dist}"/>
   <mkdir dir="${dist}/pages"/>
    <mkdir dir="${dist}/WEB-INF"/>
    <mkdir dir="${dist}/WEB-INF/classes"/>
    <mkdir dir="${dist}/WEB-INF/lib"/>
    <copy todir="${dist}">
      <fileset dir="${its}">
        <include name="**/*.*"/>
        <exclude name="**/jsp_servlet/*.class"/>
        <exclude name="**/build.xml"/>
       <exclude name="**/build.properties"/>
      </fileset>
    </copy>
<!--    <copy todir="${dist}/WEB-INF/classes">
      <fileset dir="${project.dir}/${bin.dir}">
        <include name="**/*.*"/>
        <exclude name="**/jsp_servlet/*.class"/>
      </fileset>
    </copy> 
-->   
  </target>


 
  <target name="deploy" depends="undeploy,init" >
    <!-- Create the distribution directory -->
    <delete file="${war}.war" failonerror="false" />
   <delete dir="${deploy.dir}/${war}" failonerror="false"/>
 <jar jarfile="${war}.war" basedir="${dist}"/>   
   <copy file="${war}.war" todir="${deploy.dir}"/>
    <delete file="${war}.war" failonerror="false" />
    <delete dir="${dist}" failonerror="false" />
  </target>
 
  <target name="deployTool">
   <ant antfile="./deploy.xml" dir="." target="deploy" inheritall="true">
   </ant>
  </target>
 
 
 
 
 
  <target name="undeploy">
    <!-- Sometimes you can undeploy with deleting the module file but it is best dealt on an appserver basis
         at undeployTool target -->
  </target>
  <target name="undeployTool">
   <ant antfile="./undeploy.xml" dir="." target="undeploy" inheritall="true">
   </ant>
  </target>  
 

</project>
 

 

build.properties

#LOMBOZ BUILD FILE PROPERTIES- UPDATED:Thu Sep 01 22:20:05 CST 2005
#Thu Sep 01 22:20:05 CST 2005
war=its
eclipse.home=/D/:/Eclipse3.1/eclipse/
module=ITSSystem
adminToolPath=
project.dir=../../
#ejbsrc.dir=ejbsrc
#deploy.dir=F/:/bea/user_projects/domains/mydomain/applications
deploy.dir=C/:/Tomcat 5.0/webapps
#project.path=D/://eclipse-3.0//workspace//archive//bin
#bin.dir=bin
jsp.dir=pages

 

 

build.xml     >>>>>>>>>  不打包,直接拷文件夹到webapps下<<<<<<<<<

<!-- Copyright (c) 2002 by ObjectLearn. All Rights Reserved. -->
<project name="ITSSystem"  default="deploy"  basedir=".">


  <!-- set global properties for this build -->
  <property file="build.properties"/>
  <property name="dist" value="../../dist" />
  <property name="its" value="../" />
 
  <target name = "update"> 
    <delete file="${deploy.dir}/${war}.war" failonerror="false" />
 <copy todir="${deploy.dir}/${war}/WEB-INF/classes">
  <fileset dir="${basedir}/classes"></fileset>
 </copy>
 <copy todir="${deploy.dir}/${war}/${jsp.dir}">
  <fileset dir="${its}/${jsp.dir}"></fileset>
 </copy>
 <copy todir="${deploy.dir}/${war}/WEB-INF">
  <fileset file="${basedir}/struts-config.xml"/>
  <fileset file="${basedir}/web.xml"/>
 </copy>
   <copy todir="${deploy.dir}/${war}/style">
    <fileset dir="${its}/style"></fileset>
   </copy>
  </target>  
 
  <target name="init">
    <!-- Create the dist directory structure used by compile
         and copy the deployment descriptors into it-->
    <mkdir dir="${dist}"/>
   <mkdir dir="${dist}/pages"/>
    <mkdir dir="${dist}/WEB-INF"/>
    <mkdir dir="${dist}/WEB-INF/classes"/>
    <mkdir dir="${dist}/WEB-INF/lib"/>
    <copy todir="${dist}">
      <fileset dir="${its}">
        <include name="**/*.*"/>
        <exclude name="**/jsp_servlet/*.class"/>
        <exclude name="**/build.xml"/>
       <exclude name="**/build.properties"/>
       <exclude name="**/src/**"/>
       <exclude name="**/work/**"/>
       <exclude name=".classpath"/>
       <exclude name=".project"/>
       <exclude name=".tomcatplugin"/>
      </fileset>
    </copy>
<!--    <copy todir="${dist}/WEB-INF/classes">
      <fileset dir="${project.dir}/${bin.dir}">
        <include name="**/*.*"/>
        <exclude name="**/jsp_servlet/*.class"/>
      </fileset>
    </copy> 
-->   
  </target>


 
  <target name="deploy" depends="undeploy,init" >
    <!-- Create the distribution directory -->
    <delete file="${war}.war" failonerror="false" />
   <delete dir="${deploy.dir}/${war}" failonerror="false"/>
<!-- <jar jarfile="${war}.war" basedir="${dist}"/>   
   <copy file="${war}.war" todir="${deploy.dir}"/>
    <delete file="${war}.war" failonerror="false" />
    -->
   <mkdir dir="${deploy.dir}/${war}"/>
   <copy todir="${deploy.dir}/${war}">
    <fileset dir="${dist}">
     <include name="**/*.*"/>
    </fileset>
   </copy>
    <delete dir="${dist}" failonerror="false" />
  </target>
 
  <target name="deployTool">
   <ant antfile="./deploy.xml" dir="." target="deploy" inheritall="true">
   </ant>
  </target>
 
 
 
 
 
  <target name="undeploy">
    <!-- Sometimes you can undeploy with deleting the module file but it is best dealt on an appserver basis
         at undeployTool target -->
  </target>
  <target name="undeployTool">
   <ant antfile="./undeploy.xml" dir="." target="undeploy" inheritall="true">
   </ant>
  </target>  
 

</project>

你可能感兴趣的:([Ant存档]改改就行了,省得老写)