首页 > 代码库 > Ant自动构建
Ant自动构建
Ant+jenkins+tomcat
<project name="buildWar" default="clean"> <property name="tomcat.home" value="http://www.mamicode.com/opt/tomcat" /> <property name="build.path" value="http://www.mamicode.com/build/classes" /> <property name="output.path" value="http://www.mamicode.com/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" http://www.mamicode.com/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>
Ant自动构建
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。