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>

  

上一篇:Android 内核初识(8)Binder


下一篇:wxPython实现在浏览器中打开链接