ant文件


<?xml version="1.0" encoding="UTF-8"?>
<project name="newDemo" default="openExplorer" basedir=".">
<!--基础设置-->
<property name="project.name" value="newDemo" />
<property name="src.dir" value="src" />
<property name="web.dir" value="WebContent" />
<property name="build.dir" value="${web.dir}/WEB-INF/classes" />
<property name="lib.dir" value="${web.dir}/WEB-INF/lib" />
<property name="dist.dir" value="dist" />
<property name="dist.version" value="1.0.0" />
<property name="tomcat.home" value="D:/Program Files/apache-tomcat-7.0.5/"/>
<!--类库路径-->
<path id="classpath">
<fileset dir="${lib.dir}">
<include name="**/*.jar" />
</fileset>
</path>
<!--初始化-->
<target name="init">
<echo message="beginning ant tasks" />
</target>
<!--清除旧文件-->
<target name="clean" depends="init" description="remove all old files">
<delete dir="${build.dir}" />
<delete dir="${dist.dir}" />
</target>
<!--新建编译目录-->
<target name="prepare" depends="clean">
<echo message="mkdir WebContent/WEB-INF/classes" />
<mkdir dir="${build.dir}" />
</target>
<!--拷贝不需要编译的文件到build.dir-->
<target name="copy" depends="prepare" description="copy *.xml *.properties etc file to build path">
<copy todir="${build.dir}" overwrite="true">
<fileset dir="${src.dir}">
<include name="**/*.xml" />
<include name="**/*.properties" />
<include name="**/*.xlsx" />
</fileset>
</copy>
</target>
<!--编译源代码-->
<target name="complie" depends="copy" description="complies all src files">
<javac srcdir="${src.dir}" destdir="${build.dir}" includes="**/*.java" encoding="UTF-8" debug="true">
<classpath refid="classpath" />
</javac>
<echo message="complie completed !" />
</target>
<!--打包war包-->
<target name="war" depends="complie" description="compress war file">
<mkdir dir="${dist.dir}" />
<war warfile="${dist.dir}/newDemo.war">
<fileset dir="${web.dir}">
</fileset>
</war>
<echo message="build war ok...." />
</target>
<!--将war包拷贝到tomcat/-->
<target name="copyTotomcat" depends="war" description="copy war to tomcat...">
<copy todir="${tomcat.home}/webapps" overwrite="true">
<fileset dir="${dist.dir}">
<include name="**/*.war" />
</fileset>
</copy>
<echo message="copy war to tomcat ok...." />
</target>

<!--stop tomcat/-->
<target name="stopTomcat" depends="copyTotomcat">
<exec executable="${tomcat.home}/bin/shutdown.bat" spawn="true" vmlauncher="false">
<env key="CATALINA_HOME" value="${tomcat.home}" />
<arg line="/c start ${tomcat.home}/bin/shutdown.bat" />
</exec>
<echo message="stop tomcat ok...." />
</target>
<!-- start tomcat/-->
<target name="startTomcat" depends="stopTomcat" description="tomcat starting.....">
<exec executable="${tomcat.home}/bin/startup.bat" spawn="true" vmlauncher="false">
<env key="CATALINA_HOME" value="${tomcat.home}" />
<arg line="/c start ${tomcat.home}/bin/startup.bat" />
</exec>
<echo message="start tomcat ok ...." />
</target>
<!-- open browser /-->
<target name="openExplorer" depends="startTomcat" description="tomcat starting.....">
<exec executable="explorer">
<arg line="http://10.144.154.217:8080/newDemo"/>
</exec>
</target>
</project>

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值