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 <mkdir dir="${javadoc.home}"/>
114 <mkdir dir="${deploy.home}/log"/>
119 <!-- The "clean" target removes the deployment home directory structure,
120 so that the next time the "compile" target is requested, it will need
121 to compile everything from scratch.
125 <target name="clean">
126 <delete dir="${deploy.home}"/>
130 <!-- The "compile" target is used to compile (or recompile) the Java classes
131 that make up this web application. The recommended source code directory
132 structure makes this very easy because the <javac> task automatically
133 works its way down a source code hierarchy and compiles any class that
134 has not yet been compiled, or where the source file is newer than the
137 Feel free to adjust the compilation option parameters (debug,
138 optimize, and deprecation) to suit your requirements. It is also
139 possible to base them on properties, so that you can adjust this
142 The "compile" task depends on the "prepare" task, so the deployment
143 home directory structure will be created if needed the first time.
146 <target name="compile" depends="prepare">
147 <javac srcdir="source" destdir="${deploy.home}/WEB-INF/classes"
148 debug="on" optimize="off" deprecation="on">
149 <classpath refid="project.class.path"/>
151 <copy todir="${deploy.home}/WEB-INF/classes">
152 <fileset dir="source" includes="**/*.properties"/>
154 <copy todir="${deploy.home}">
155 <fileset dir="source" includes="**/content-types.properties"/>
158 Now you should call perms.sh(-dist) in order to set
159 the permissions of your installed files to a meaningful
166 <!-- The "javadoc" target is used to create the Javadoc API documentation
167 for the Java classes in this web application. It is assumed that
168 this documentation is included in the deployed application, so the
169 example below generates the Javadoc HTML files in a subdirectory under
170 the deployment home directory. Feel free to customize the options for
171 the JavaDoc task, after consulting the Ant documentation.
174 <target name="javadoc" depends="prepare">
175 <javadoc packagenames="mir.*, mircoders.*"
176 sourcefiles="source/${app.name}.java,source/Open${app.name}.java"
178 destdir="${javadoc.home}">
179 <classpath refid="project.class.path"/>
184 <!-- The "all" target rebuilds everything by executing the "clean"
185 target first, which forces the "compile" target to compile all
186 source code instead of just the files that have been changed.
189 <target name="all" depends="clean,prepare,compile,javadoc"/>
192 <!-- The "dist" target builds the distribution Web ARchive (WAR) file
193 for this application, suitable for distribution to sites that wish
194 to install your application. It also creates a JAR file containing
195 the source code for this application, if you wish to distribute
198 <target name="dist" depends="prepare,compile">
199 <jar jarfile="mirbase.jar"
201 basedir="../Mir/WEB-INF/classes"/>
202 <jar jarfile="${dist.src}"
204 <jar jarfile="${dist.war}"
205 basedir="${deploy.home}"/>