ant编译打包学习笔记
学习了一下使用ant给web项目打包,使用ant命令预先安装ant软件,并且配置
环境变量:
ANT_HOME=ant安装目录
PATH=%PATH%;%ANT_HOME%/bin
根据http://blog.csdn.net/lip009/article/details/1226931 自己写了一个 build.xml文件
<?xml version="1.0" encoding="UTF-8"?> <project name="AntTest" basedir="." default="war"> <description> This is a description for AntTest </description> <!-- 设置一些变量 --> <property name="webroot" location="WebRoot"></property> <property name="classes.dir" location="${webroot}/WEB-INF/classes"></property> <property name="lib.dir" location="${webroot}/WEB-INF/lib"></property> <property name="dist.dir" location="dist"></property> <property name="config.dir" location="config"></property> <path id="classpath"> <fileset dir="${classes.dir}"></fileset> <fileset dir="${lib.dir}"></fileset> </path> <target name="init-dir" > <mkdir dir="${classes.dir}"/> <mkdir dir="${lib.dir}"/> <mkdir dir="${dist.dir}"/> <echo>创建目录,完成.</echo> </target> <target name="src-compile"> <javac target="1.6" srcdir="src" destdir="${classes.dir}" classpathref="classpath" includeantruntime="false"> <!-- 设置编码方式,否则控制台乱码 --> <compilerarg line="-encoding UTF-8"/> </javac> <echo>编译文件,完成.</echo> </target> <target name="copy-config"> <copy todir="${classes.dir}"> <fileset dir="${config.dir}" includes="**/*.*"></fileset> </copy> <echo>拷贝配置文件到classes下,完成.</echo> </target> <target name="war" depends="init-dir,src-compile,copy-config"> <war destfile="${dist.dir}/${ant.project.name}.war" basedir="${webroot}"></war> <echo>生成War包,完成.</echo> </target> </project>这只是最简单的一个buil.xml 了,如果要打jar包,还可以在里面加.
相关推荐
BitsPlayer 2020-05-29
roygbip 2020-02-16
BitsPlayer 2020-02-13
lrcoop 2020-02-03
chichichi0 2020-01-06
BitsPlayer 2019-12-19
BitsPlayer 2019-12-14
xueliangEmail 2013-07-22
cailianren 2010-04-15
wugang0 2019-11-09
lustdevil 2011-08-28
evilvoid 2008-04-17
leonranri 2019-11-05
leeccr 2019-10-31
evilvoid 2010-02-02