• Ant自动构建


    Ant+jenkins+tomcat

    <project name="buildWar" default="clean">  
        <property name="tomcat.home" value="/opt/tomcat" />
        <property name="build.path" value="build/classes" />
        <property name="output.path" value="output" />
        <!-- 配置编译需要的jar包 -->
        <path id="compile.classpath">  
            <fileset dir="WebRoot/WEB-INF/lib">  
                <include name="*.jar"/>  
            </fileset>  
            <fileset dir="${tomcat.home}/lib">  
                <include name="**/*.jar"/>  
            </fileset>  
        </path>  
         <!-- 初始化,新建文件夹 -->
        <target name="init">  
            <mkdir dir="${build.path}"/>  
            <mkdir dir="${output.path}" />  
        </target>  
         <!-- 编译 -->
        <target name="compile" depends="init" >  
            <javac destdir="${build.path}" debug="true" srcdir="src"  encoding="utf-8" includeantruntime="false" >  
                <classpath refid="compile.classpath"/>  
            </javac>  
            <echo message="Compile Finished!"></echo>
        </target>  
        <!-- 打包 -->
        <target name="war" depends="compile">
            <copydir  dest="WebRoot/WEB-INF/classes" src="src" excludes="**/*.java" />
            <war destfile="${output.path}/E-Learning.war" webxml="WebRoot/WEB-INF/web.xml" >  
                <fileset dir="WebRoot"/>  
                <classes dir="${build.path}"/>  
            </war>
            <echo message="Package Finished!"></echo>
        </target>   
         <!-- 部署 -->
        <target name="deploy" depends="war">
            <delete dir="${tomcat.home}/webapps/E-Learning" />
            <delete dir="${tomcat.home}/webapps/E-Learning.war" />
            <copy todir="${tomcat.home}/webapps">
                <fileset file="${output.path}/E-Learning.war" />
            </copy>
            <echo message="Deploy Finished!"></echo>
        </target>
         <!-- 清理 -->
        <target name="clean" depends="deploy">  
            <delete dir="${build.path}" />  
            <delete dir="build" />  
            <delete dir="${output.path}" />  
            <echo message="Clean Finished!"></echo>
        </target>  
    </project>
    

      

  • 相关阅读:
    例20:希尔排序
    例19:直接插入排序
    例14:计算某日是该年的第几天
    为自己
    hdoj--1027--Ignatius and the Princess II(dfs)
    UESTC--758--P酱的冒险旅途(模拟)
    nyoj--990--蚂蚁感冒(模拟)(思维题)
    历届试题 邮局(dfs+剪枝)
    历届试题 数字游戏
    历届试题 回文数字
  • 原文地址:https://www.cnblogs.com/libaoting/p/4084668.html
Copyright © 2020-2023  润新知