1 <project name="Mir" default="compile" basedir=".">
4 <!-- What this file is all about
6 You can use this version of build.xml to use directly with ant
7 i.e. without the build.sh script. Simply call ant and let it all
11 <!-- Property Definitions
13 Please not that only the first couple of properties have to be defined.
14 The rest, residing below the "no customization needed" line may be
15 customized if you know what you are doing. Else, leave the defaults
16 and use them to look up where ant places all the files.
18 app.name Base name of this application, used to
19 construct filenames and directories.
21 deploy.home The name of the directory into which the
22 deployment hierarchy will be created.
23 Normally, this will be the name of a
24 subdirectory under $TOMCAT_HOME/webapps.
26 deploy.classes The name of the directory that will contain
29 dist.home The name of the base directory in which
30 distribution files are created.
32 dist.src The name of the distribution JAR file
33 containing the application source code,
34 to be stored in the "dist.home" directory.
35 This filename should end with ".jar".
37 dist.war The name of the Web ARchive (WAR) file
38 containing our deployable application.
39 This filename should end with ".war".
41 javadoc.home The name of the base directory in which
42 the JavaDoc documentation for this application
45 tomcat.home The name of the base directory in which
46 Tomcat has been installed. This value is
47 normally set automatically from the value
48 of the TOMCAT_HOME environment variable.
50 java.home The location of your Java SDK.
52 java.localhome Where your local java classes and jar files
55 tomcat.home The location of the tomcat root directory.
59 <property name="app.name" value="Mir"/>
60 <property name="deploy.home" value="../${app.name}"/>
63 <!-- No customization required after this line -->
65 <property name="dist.home" value="${deploy.home}"/>
66 <property name="deploy.webinf" value="${deploy.home}/WEB-INF"/>
67 <property name="deploy.classes" value="${deploy.webinf}/classes"/>
68 <property name="dist.src" value="${app.name}.jar"/>
69 <property name="dist.war" value="${app.name}.war"/>
70 <property name="javadoc.home" value="${deploy.home}/javadoc"/>
71 <!-- The following 3 properties seem redundant -->
72 <property name="java.home" value="/usr/lib/j2sdk1.3/"/>
73 <property name="java.localhome" value="/usr/share/java/"/>
74 <property name="tomcat.home" value="/usr/share/tomcat/"/>
77 <!-- Construct the classpath -->
78 <path id="project.class.path">
79 <pathelement path="${deploy.home}"/>
80 <pathelement path="${deploy.classes}"/>
81 <pathelement path="source"/>
83 <include name="*.jar"/>
85 <!-- <fileset dir="${java.home}/lib">
86 <include name="tools.jar"/>
87 <include name="rt.jar"/>
89 <fileset dir="${java.localhome}">
90 <include name="*.jar"/>
92 <pathelement path="${tomcat.home}/lib/tomcat.jar"/>
98 <!-- The "prepare" target is used to construct the deployment home
99 directory structure (if necessary), and to copy in static files
100 as required. In the example below, Ant is instructed to create
101 the deployment directory, copy the contents of the "web/" source
102 hierarchy, and set up the WEB-INF subdirectory appropriately.
105 <target name="prepare">
106 <mkdir dir="${deploy.home}"/>
107 <copy todir="${deploy.home}">
110 <mkdir dir="${deploy.home}/templates"/>
111 <copy todir="${deploy.home}/templates">
112 <fileset dir="templates"/>
114 <mkdir dir="${deploy.home}/src"/>
115 <copy todir="${deploy.home}/src">
116 <fileset dir="source"/>
119 <mkdir dir="${deploy.home}/WEB-INF"/>
120 <copy file="etc/web.xml" tofile="${deploy.home}/WEB-INF/web.xml"/>
121 <mkdir dir="${deploy.classes}"/>
122 <mkdir dir="${deploy.home}/WEB-INF/lib"/>
123 <copy todir="${deploy.home}/WEB-INF/lib">
125 <exclude name="ant.jar"/>
126 <exclude name="xerces.jar"/>
129 <mkdir dir="${javadoc.home}"/>
130 <mkdir dir="${deploy.home}/log"/>
136 <!-- The "clean" target removes the deployment home directory structure,
137 so that the next time the "compile" target is requested, it will need
138 to compile everything from scratch.
142 <target name="clean">
143 <delete dir="${deploy.classes}"/>
144 <mkdir dir="${deploy.classes}"/>
149 <!-- The "mrproper" target removes the entire deploy dir - including all
150 built pages and images.
153 <target name="mrproper">
154 <delete dir="${deploy.home}"/>
159 <!-- The "compile" target is used to compile (or recompile) the Java classes
160 that make up this web application. The recommended source code directory
161 structure makes this very easy because the <javac> task automatically
162 works its way down a source code hierarchy and compiles any class that
163 has not yet been compiled, or where the source file is newer than the
166 Feel free to adjust the compilation option parameters (debug,
167 optimize, and deprecation) to suit your requirements. It is also
168 possible to base them on properties, so that you can adjust this
171 The "compile" task depends on the "prepare" task, so the deployment
172 home directory structure will be created if needed the first time.
175 <target name="compile" depends="prepare">
176 <antcall target="clean"/>
177 <javac srcdir="source" destdir="${deploy.classes}"
178 debug="on" optimize="off" deprecation="on">
179 <classpath refid="project.class.path"/>
181 <copy todir="${deploy.classes}">
182 <fileset dir="source" includes="**/*.properties"/>
184 <copy todir="${deploy.home}">
185 <fileset dir="source" includes="**/content-types.properties"/>
187 <exec executable="./perms.sh"/>
191 <!-- The "javadoc" target is used to create the Javadoc API documentation
192 for the Java classes in this web application. It is assumed that
193 this documentation is included in the deployed application, so the
194 example below generates the Javadoc HTML files in a subdirectory under
195 the deployment home directory. Feel free to customize the options for
196 the JavaDoc task, after consulting the Ant documentation.
199 <target name="javadoc" depends="prepare">
200 <javadoc packagenames="mir.*, mircoders.*"
201 sourcefiles="source/${app.name}.java,source/Open${app.name}.java"
203 destdir="${javadoc.home}">
204 <classpath refid="project.class.path"/>
209 <!-- The "all" target rebuilds everything by executing the "clean"
210 target first, which forces the "compile" target to compile all
211 source code instead of just the files that have been changed.
214 <target name="all" depends="clean,prepare,compile,javadoc"/>
217 <!-- The "dist" target builds the distribution Web ARchive (WAR) file
218 for this application, suitable for distribution to sites that wish
219 to install your application. It also creates a JAR file containing
220 the source code for this application, if you wish to distribute
223 <target name="dist" depends="prepare,compile">
224 <jar jarfile="${dist.home}/mirbase.jar"
226 basedir="${deploy.classes}"/>
227 <jar jarfile="${dist.home}/${dist.src}"
229 <jar jarfile="${dist.home}/${dist.war}"
230 basedir="${deploy.home}"
231 excludes="${dist.war}"/>