Ant 编译部署工程

<?xml version="1.0" encoding="UTF-8"?>
<project name="icap" basedir="." default="all">
    
 
    <property name="tomcat.home" value="D:/tomcat" />
    
 
    <property name="servlet-api.jar" value="${tomcat.home}/lib/servlet-api.jar" />
    <property name="jsp-api.jar"     value="${tomcat.home}/lib/servlet-api.jar" />
    <property name="distpath.project" value="${tomcat.home}/webapps" />
    
 
    <property name="project.distname" value="icap" />  
    <property name="dir.src" value="src" />
    <property name="dir.webinf" value="WebRoot/WEB-INF" />
    <property name="dir.classes" value="${dir.webinf}/classes" />
    
 
    <path id="compile.classpath">
        <pathelement path="${dir.classes}" />
        <pathelement path="${classpath}" />
        <pathelement path="${servlet-api.jar}" />
        <pathelement path="${jsp-api.jar}" />
        <fileset dir="${dir.webinf}/lib">
            <include name="*.jar" />
        </fileset>
     
    </path>
    
    
    <target name="prepare">
        <tstamp />
    </target>
    
	<target name="resources">
	        <copy todir="${distpath.project}/${project.distname}" includeEmptyDirs="no">
	            <fileset dir="WebRoot/"> 
	                <patternset> 
	                    <include name="**/*.*" /> 
	                </patternset>
	            </fileset>
	        </copy>
	        <native2ascii src="WebRoot" dest="${distpath.project}/${project.distname}" includes="**/*.properties" encoding="gb2312" /> 
	 </target>
	
 
    
  
    <target name="compile" depends="prepare,resources">
    	 <mkdir dir="${distpath.project}/${project.distname}/WEB-INF/classes/"/>    
         <javac srcdir="${dir.src}" destdir="${distpath.project}/${project.distname}/WEB-INF/classes/" encoding="utf-8">
            <classpath refid="compile.classpath" />
        </javac>
    </target>
    
  
    <target name="clean" description="Prepare for clean build"> 
        <delete dir="${distpath.project}/${project.distname}" />
        <delete dir="${distpath.project}/${project.distname}.war" />
        <mkdir dir="${dir.classes}" /> 
    </target>
    
 
    <target name="project" depends="clean,prepare,compile" />
    
 
    <target name="dist" description="Create binary distribution">
        <war basedir="WebRoot" warfile="${distpath.project}/${project.distname}.war" webxml="${dir.webinf}/web.xml">
            <exclude name="${distpath.project}/${project.distname}.war" />
        </war>
    </target> 
 
    <target name="all" depends="project" />
</project>

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值