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
12 app.name Base name of this application, used to
13 construct filenames and directories.
15 deploy.home The name of the directory into which the
16 deployment hierarchy will be created.
17 Normally, this will be the name of a
18 subdirectory under $TOMCAT_HOME/webapps.
20 dist.home The name of the base directory in which
21 distribution files are created.
23 dist.src The name of the distribution JAR file
24 containing the application source code,
25 to be stored in the "dist.home" directory.
26 This filename should end with ".jar".
28 dist.war The name of the Web ARchive (WAR) file
29 containing our deployable application.
30 This filename should end with ".war".
32 javadoc.home The name of the base directory in which
33 the JavaDoc documentation for this application
36 tomcat.home The name of the base directory in which
37 Tomcat has been installed. This value is
38 normally set automatically from the value
39 of the TOMCAT_HOME environment variable.
41 java.home The location of your Java SDK.
43 java.localhome Where your local java classes and jar files
46 tomcat.home The location of the tomcat root directory.
50 <property name="app.name" value="Mir"/>
51 <property name="deploy.home" value="../${app.name}"/>
52 <property name="dist.home" value="${deploy.home}"/>
53 <property name="dist.src" value="${app.name}.jar"/>
54 <property name="dist.war" value="${app.name}.war"/>
55 <property name="javadoc.home" value="${deploy.home}/javadoc"/>
57 <property name="java.home" value="/usr/lib/j2sdk1.3/"/>
58 <property name="java.localhome" value="/usr/share/java/"/>
59 <property name="tomcat.home" value="/usr/share/tomcat/"/>
62 <!-- Construct the classpath -->
63 <path id="project.class.path">
64 <pathelement path="${deploy.home}"/>
65 <pathelement path="${deploy.home}/WEB-INF/classes"/>
66 <pathelement path="source"/>
68 <include name="*.jar"/>
70 <fileset dir="${java.home}/lib">
71 <include name="tools.jar"/>
72 <include name="rt.jar"/>
74 <fileset dir="${java.localhome}">
75 <include name="*.jar"/>
77 <pathelement path="${tomcat.home}/lib/tomcat.jar"/>
82 <!-- The "prepare" target is used to construct the deployment home
83 directory structure (if necessary), and to copy in static files
84 as required. In the example below, Ant is instructed to create
85 the deployment directory, copy the contents of the "web/" source
86 hierarchy, and set up the WEB-INF subdirectory appropriately.
89 <target name="prepare">
90 <mkdir dir="${deploy.home}"/>
91 <copy todir="${deploy.home}">
94 <mkdir dir="${deploy.home}/templates"/>
95 <copy todir="${deploy.home}/templates">
96 <fileset dir="templates"/>
98 <mkdir dir="${deploy.home}/src"/>
99 <copy todir="${deploy.home}/src">
100 <fileset dir="source"/>
103 <mkdir dir="${deploy.home}/WEB-INF"/>
104 <copy file="etc/web.xml" tofile="${deploy.home}/WEB-INF/web.xml"/>
105 <mkdir dir="${deploy.home}/WEB-INF/classes"/>
106 <mkdir dir="${deploy.home}/WEB-INF/lib"/>
107 <copy todir="${deploy.home}/WEB-INF/lib">
109 <exclude name="ant.jar"/>
110 <exclude name="xerces.jar"/>
113 <copy todir="${deploy.home}/WEB-INF/classes">
114 <fileset dir="bundles"/>
116 <mkdir dir="${javadoc.home}"/>
117 <mkdir dir="${deploy.home}/log"/>
122 <!-- The "clean" target removes the deployment home directory structure,
123 so that the next time the "compile" target is requested, it will need
124 to compile everything from scratch.
128 <target name="clean">
129 <delete dir="${deploy.home}"/>
133 <!-- The "compile" target is used to compile (or recompile) the Java classes
134 that make up this web application. The recommended source code directory
135 structure makes this very easy because the <javac> task automatically
136 works its way down a source code hierarchy and compiles any class that
137 has not yet been compiled, or where the source file is newer than the
140 Feel free to adjust the compilation option parameters (debug,
141 optimize, and deprecation) to suit your requirements. It is also
142 possible to base them on properties, so that you can adjust this
145 The "compile" task depends on the "prepare" task, so the deployment
146 home directory structure will be created if needed the first time.
149 <target name="compile" depends="prepare">
150 <javac srcdir="source" destdir="${deploy.home}/WEB-INF/classes"
151 debug="on" optimize="off" deprecation="on">
152 <classpath refid="project.class.path"/>
154 <copy todir="${deploy.home}/WEB-INF/classes">
155 <fileset dir="source" includes="**/*.properties"/>
157 <copy todir="${deploy.home}">
158 <fileset dir="source" includes="**/content-types.properties"/>
161 Now you should call perms.sh(-dist) in order to set
162 the permissions of your installed files to a meaningful
169 <!-- The "javadoc" target is used to create the Javadoc API documentation
170 for the Java classes in this web application. It is assumed that
171 this documentation is included in the deployed application, so the
172 example below generates the Javadoc HTML files in a subdirectory under
173 the deployment home directory. Feel free to customize the options for
174 the JavaDoc task, after consulting the Ant documentation.
177 <target name="javadoc" depends="prepare">
178 <javadoc packagenames="mir.*, mircoders.*"
179 sourcefiles="source/${app.name}.java,source/Open${app.name}.java"
181 destdir="${javadoc.home}">
182 <classpath refid="project.class.path"/>
187 <!-- The "all" target rebuilds everything by executing the "clean"
188 target first, which forces the "compile" target to compile all
189 source code instead of just the files that have been changed.
192 <target name="all" depends="clean,prepare,compile,javadoc"/>
195 <!-- The "dist" target builds the distribution Web ARchive (WAR) file
196 for this application, suitable for distribution to sites that wish
197 to install your application. It also creates a JAR file containing
198 the source code for this application, if you wish to distribute
201 <target name="dist" depends="prepare,compile">
202 <jar jarfile="mirbase.jar"
204 basedir="../Mir/WEB-INF/classes"/>
205 <jar jarfile="${dist.src}"
207 <jar jarfile="${dist.war}"
208 basedir="${deploy.home}"/>