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="./bin/${app.name}"/>
62 <!-- don't use unless your Jikes is >= v1.18 -->
63 <!-- <property name="build.compiler" value="jikes"/>-->
66 <!-- No customization required after this line -->
68 <property environment="env"/>
69 <property name="dist.home" value="${deploy.home}"/>
70 <property name="deploy.webinf" value="${deploy.home}/WEB-INF"/>
71 <property name="deploy.classes" value="${deploy.webinf}/classes"/>
72 <property name="dist.src" value="${app.name}.jar"/>
73 <property name="dist.war" value="${app.name}.war"/>
74 <property name="javadoc.home" value="${deploy.home}/javadoc"/>
75 <property name="tomcat.home" value="${env.TOMCAT_HOME}"/>
79 <!-- Construct the classpath -->
80 <path id="project.class.path">
81 <pathelement path="${deploy.home}"/>
82 <pathelement path="${deploy.classes}"/>
83 <pathelement path="source"/>
84 <pathelement path="etc/extrasource"/>
86 <include name="*.jar"/>
88 <pathelement path="${tomcat.home}/lib/tomcat.jar"/>
89 <!-- for libs shared between tomcat and webapps (tomcat 3.3.x) -->
90 <fileset dir="${tomcat.home}">
91 <include name="lib/common/*.jar" />
93 <!-- for libs shared between webapps (tomcat 3.3.x) -->
94 <fileset dir="${tomcat.home}">
95 <include name="lib/apps/*.jar" />
97 <!-- for libs shared between tomcat and webapps (tomcat 4.x.x) -->
98 <fileset dir="${tomcat.home}">
99 <include name="common/lib/*.jar" />
101 <!-- for libs shared between webapps (tomcat 4.0.x) -->
102 <fileset dir="${tomcat.home}">
103 <include name="lib/*.jar" />
105 <!-- for libs shared between webapps (tomcat 4.1.x) -->
106 <fileset dir="${tomcat.home}">
107 <include name="shared/lib/*.jar" />
113 <!-- The "prepare" target is used to construct the deployment home
114 directory structure (if necessary), and to copy in static files
115 as required. In the example below, Ant is instructed to create
116 the deployment directory, copy the contents of the "web/" source
117 hierarchy, and set up the WEB-INF subdirectory appropriately.
120 <target name="prepare">
121 <mkdir dir="${deploy.home}"/>
122 <mkdir dir="${deploy.webinf}"/>
123 <mkdir dir="${deploy.classes}"/>
124 <mkdir dir="${deploy.webinf}/log"/>
126 <copy todir="${deploy.home}">
130 <copy todir="${deploy.webinf}/etc">
131 <fileset dir="etc" excludes="bundles/** web.xml"/>
133 <copy todir="${deploy.classes}/bundles">
134 <fileset dir="etc/bundles"/>
136 <copy todir="${deploy.webinf}" file="etc/web.xml"/>
138 <copy todir="${deploy.webinf}/templates">
139 <fileset dir="templates"/>
142 <copy todir="${deploy.webinf}" file="source/default.properties" />
144 <copy todir="${deploy.classes}/bundles">
145 <fileset dir="bundles"/>
148 <copy todir="${deploy.home}/WEB-INF/lib">
150 <exclude name="ant.jar"/>
151 <exclude name="xerces.jar"/>
158 <!-- The "clean" target removes the deployment home directory structure,
159 so that the next time the "compile" target is requested, it will need
160 to compile everything from scratch.
164 <target name="clean">
165 <delete dir="${deploy.classes}"/>
166 <mkdir dir="${deploy.classes}"/>
171 <!-- The "mrproper" target removes the entire deploy dir - including all
172 built pages and images.
175 <target name="mrproper">
176 <delete dir="${deploy.home}"/>
179 <!-- drop out if $TOMCAT_HOME is not set>-->
180 <target name="testtomcat" unless="tomcat.present">
181 <fail message="the $$TOMCAT_HOME environment variable is not set or is set to the wrong path. Please set it first. giving up!"/>
184 <!-- The "compile" target is used to compile (or recompile) the Java classes
185 that make up this web application. The recommended source code directory
186 structure makes this very easy because the <javac> task automatically
187 works its way down a source code hierarchy and compiles any class that
188 has not yet been compiled, or where the source file is newer than the
191 Feel free to adjust the compilation option parameters (debug,
192 optimize, and deprecation) to suit your requirements. It is also
193 possible to base them on properties, so that you can adjust this
196 The "compile" task depends on the "prepare" task, so the deployment
197 home directory structure will be created if needed the first time.
200 <target name="compile" depends="prepare">
201 <!-- check to see if $TOMCAT_HOME was set to something useful.. -->
202 <available file="${tomcat.home}/conf" property="tomcat.present"/>
203 <antcall target="testtomcat"/>
205 <!--<antcall target="clean"/>-->
209 includes="**/*.java"/>
210 <!-- ML: now why can't this be added?
212 dir="etc/extrasource"
213 includes="**/*.java"/> -->
218 dir="${deploy.classes}"
219 includes="**/*.class"/>
221 <javac destdir="${deploy.classes}"
222 debug="on" optimize="off" deprecation="on">
224 <src path="etc/extrasource"/>
225 <classpath refid="project.class.path"/>
231 <target name="perms">
232 <exec executable="./perms.sh"/>
236 <!-- The "javadoc" target is used to create the Javadoc API documentation
237 for the Java classes in this web application. It is assumed that
238 this documentation is included in the deployed application, so the
239 example below generates the Javadoc HTML files in a subdirectory under
240 the deployment home directory. Feel free to customize the options for
241 the JavaDoc task, after consulting the Ant documentation.
244 <target name="javadoc" depends="prepare">
245 <javadoc packagenames="mir.*, mircoders.*"
246 sourcefiles="source/Mir.java,source/OpenMir.java"
248 destdir="${javadoc.home}">
249 <classpath refid="project.class.path"/>
254 <!-- The "all" target rebuilds everything by executing the "clean"
255 target first, which forces the "compile" target to compile all
256 source code instead of just the files that have been changed.
259 <target name="all" depends="clean,prepare,compile,javadoc"/>
262 <!-- The "dist" target builds the distribution Web ARchive (WAR) file
263 for this application, suitable for distribution to sites that wish
264 to install your application. It also creates a JAR file containing
265 the source code for this application, if you wish to distribute
268 <target name="dist" depends="prepare,compile">
269 <jar jarfile="${dist.home}/mirbase.jar"
271 basedir="${deploy.classes}"/>
272 <jar jarfile="${dist.home}/${dist.src}"
274 <jar jarfile="${dist.home}/${dist.war}"
275 basedir="${deploy.home}"
276 excludes="${dist.war}"/>