build.properties
1 #tomcat and java for local 2 tomcat.home=D:\software\apache-tomcat-7.0.1 3 java.home=C:\Program Files (x86)\Java\jre6\bin 4 5 #Project name 6 project.distname=performance 7 8 #Source Folder 9 dir.src=../src 10 dir.conf=../conf 11 dir.conf-local=../conf-local 12 dir.conf-test=../conf-test 13 dir.conf-pro=../conf-pro 14 15 #Builder Folder 16 build.src=../build/src 17 ##### 18 build.webContent=../build/WebContent 19 20 #Web Folder 21 webapp.context=performance 22 dir.webContent=../WebContent 23 webContent.webinf=${dir.webContent}/WEB-INF 24 webContent.classes=${dir.webContent}/WEB-INF/classes 25 webContent.lib=${dir.webContent}/WEB-INF/lib 26 27 #Deploy the path of for the web application 28 webapp.deployPath=${tomcat.home}/webapps 29 30 #API Document 31 dir.javadoc=../docs/api
build.xml
1 <?xml version="1.0" encoding="UTF-8"?> 2 <!DOCTYPE SYSTEM> 3 <project default="deploy" name="Local-System" basedir="."> 4 <description> 5 Local-System 6 </description> 7 8 <property file="build.properties"></property> 9 10 <path id="classPath"> 11 <pathelement path="${build.src}"/> 12 <fileset dir="${java.home}"> 13 <include name="**/*.jar"/> 14 </fileset> 15 <fileset dir="${webContent.lib}"> 16 <include name="**/*.jar"/> 17 </fileset> 18 <fileset dir="${tomcat.home}/lib"> 19 <include name="catalina.jar"/> 20 <include name="servlet-api.jar"/> 21 </fileset> 22 </path> 23 24 <!-- clean --> 25 <target name="clean" description="Clean all Folder for build"> 26 <echo message ="Clean all Folder for build."/> 27 <delete dir="${webContent.classes}"></delete> 28 <delete dir="${build.src}"></delete> 29 <delete dir="${webapp.deployPath}/${project.distname}"></delete> 30 <delete file="${webapp.deployPath}/${project.distname}.war"></delete> 31 <delete dir="${build.webContent}"></delete> 32 </target> 33 34 <!-- init --> 35 <target name="init" depends="clean" description="mkdir directory"> 36 <echo message ="Mkdir directory."/> 37 <mkdir dir="${webContent.classes}"/> 38 <mkdir dir="${build.src}"/> 39 </target> 40 41 <target name="compile" depends="init" description="compile classes"> 42 <echo message ="Compile classes."/> 43 <copy todir="${webContent.classes}" preservelastmodified="true"> 44 <fileset dir="${dir.src}"> 45 <include name="**/*.properties"/> 46 <include name="*.properties"/> 47 <include name="**/*.properties"/> 48 <include name="*.properties"/> 49 <include name="**/*.xml"/> 50 <include name="*.xml"/> 51 <include name="**/*.bpmn"/> 52 <include name="*.bpmn"/> 53 </fileset> 54 <fileset dir="${dir.conf}"> 55 <include name="**/*.properties"/> 56 <include name="*.properties"/> 57 <include name="**/*.xml"/> 58 <include name="*.xml"/> 59 <include name="**/*.xls"/> 60 <include name="*.xls"/> 61 <include name="**/*.jpg"/> 62 <include name="*.jpg"/> 63 </fileset> 64 <fileset dir="${dir.conf-local}"> 65 <include name="**/*.properties"/> 66 <include name="*.properties"/> 67 <!-- 68 <include name="**/*.xml"/> 69 <include name="*.xml"/> 70 --> 71 </fileset> 72 </copy> 73 74 <javac srcdir="${dir.src}" destdir="${webContent.classes}" verbose="true" source="1.6" encoding="utf-8" debug="true" includeAntRuntime="false"> 75 <classpath refid="classPath"></classpath> 76 </javac> 77 </target> 78 79 <!-- Copy WebContent to build.webContent --> 80 <target name="copyWebContentToBuild" depends="compile" description="创建打包需要的路径,拷贝源文件到打包路径下"> 81 <mkdir dir="${build.webContent}"/> 82 <copy todir="${build.webContent}"> 83 <fileset dir="${dir.webContent}"/> 84 </copy> 85 </target> 86 87 <!-- 给页面文件中的css和js引用增加版本号 --> 88 <target name="addPageVersion" depends="copyWebContentToBuild"> 89 <taskdef name="addVersion" classname="xx.xx.xx.util.AddJsAndCssVersion" classpath="${webContent.classes}"/> 90 <addVersion path="${build.webContent}" /> 91 </target> 92 93 <!-- unpack to war --> 94 <target name="antwar" depends="addPageVersion" description="Unpack the file to war file"> 95 <echo message ="Unpack the file to war file."/> 96 <war basedir="${build.webContent}" warfile="${webapp.deployPath}/${project.distname}.war" 97 webxml="${build.webContent}/WEB-INF/web.xml"> 98 <exclude name="WEB-INF/web.xml"/> 99 </war> 100 </target> 101 102 <target name="deploy" description="Clean the project" depends="antwar"> 103 <echo message ="Clean the project."/> 104 <delete dir="${webContent.classes}"></delete> 105 <delete dir="${build.src}"></delete> 106 <delete dir="${build.webContent}"></delete> 107 </target> 108 109 </project>