source: TI01-discovery/trunk/discovery/build.xml @ 187

Subversion URL: http://proj.badc.rl.ac.uk/svn/ndg/TI01-discovery/trunk/discovery/build.xml@876
Revision 187, 15.4 KB checked in by mguiterr, 14 years ago (diff)

Configuration Properties. Edit this file before build, install

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
Line 
1<!--
2     General purpose build script for web applications and web services,
3     including enhanced support for deploying directly to a Tomcat 4
4     based server.
5
6     This build script assumes that the source code of your web application
7     is organized into the following subdirectories underneath the source
8     code directory from which you execute the build script:
9
10        docs                 Static documentation files to be copied to
11                             the "docs" subdirectory of your distribution.
12
13        src                  Java source code (and associated resource files)
14                             to be compiled to the "WEB-INF/classes"
15                             subdirectory of your web applicaiton.
16
17        web                  Static HTML, JSP, and other content (such as
18                             image files), including the WEB-INF subdirectory
19                             and its configuration file contents.
20
21     $Id$
22-->
23<!-- A "project" describes a set of targets that may be requested
24     when Ant is executed.  The "default" attribute defines the
25     target which is executed if no specific target is requested,
26     and the "basedir" attribute defines the current working directory
27     from which Ant executes the requested task.  This is normally
28     set to the current working directory.
29-->
30<project name="DISCOVERY" default="compile" basedir=".">
31        <!-- ===================== Property Definitions =========================== -->
32        <!--
33
34  Each of the following properties are used in the build script.
35  Values for these properties are set by the first place they are
36  defined, from the following list:
37
38  * Definitions on the "ant" command line (ant -Dfoo=bar compile).
39
40  * Definitions from a "build.properties" file in the top level
41    source directory of this application.
42
43  * Definitions from a "build.properties" file in the developer's
44    home directory.
45
46  * Default definitions in this build.xml file.
47
48  You will note below that property values can be composed based on the
49  contents of previously defined properties.  This is a powerful technique
50  that helps you minimize the number of changes required when your development
51  environment is modified.  Note that property composition is allowed within
52  "build.properties" files as well as in the "build.xml" script.
53
54-->
55        <property file="build.properties"/>
56        <property file="${user.home}/build.properties"/>
57        <!-- ==================== File and Directory Names ======================== -->
58        <!--
59
60  These properties generally define file and directory names (or paths) that
61  affect where the build process stores its outputs.
62
63  app.name             Base name of this application, used to
64                       construct filenames and directories.
65                       Defaults to "myapp".
66
67  app.path             Context path to which this application should be
68                       deployed (defaults to "/" plus the value of the
69                       "app.name" property).
70
71  app.version          Version number of this iteration of the application.
72
73  build.home           The directory into which the "prepare" and
74                       "compile" targets will generate their output.
75                       Defaults to "build".
76
77  catalina.home        The directory in which you have installed
78                       a binary distribution of Tomcat 4.  This will
79                       be used by the "deploy" target.
80
81  dist.home            The name of the base directory in which
82                       distribution files are created.
83                       Defaults to "dist".
84
85  manager.password     The login password of a user that is assigned the
86                       "manager" role (so that he or she can execute
87                       commands via the "/manager" web application)
88
89  manager.url          The URL of the "/manager" web application on the
90                       Tomcat installation to which we will deploy web
91                       applications and web services.
92
93  manager.username     The login username of a user that is assigned the
94                       "manager" role (so that he or she can execute
95                       commands via the "/manager" web application)
96
97-->
98        <property name="app.name" value="discovery"/>
99        <property name="app.path" value="/${app.name}"/>
100        <property name="app.version" value="0.1"/>
101        <property name="build.home" value="${basedir}/build"/>
102        <property name="catalina.home" value="/usr/local/jakarta-tomcat/"/>
103        <!-- UPDATE THIS! -->
104        <property name="server.name" value="${server.name}"/>
105        <property name="dist.home" value="${basedir}/dist"/>
106        <property name="docs.home" value="${basedir}/dist/docs"/>
107        <property name="manager.url" value="http://${server.name}/manager"/>
108        <property name="manager.password" value="admin"/>
109        <property name="src.home" value="${basedir}/src"/>
110        <property name="web.home" value="${basedir}/web"/>
111        <!-- ================== Custom Ant Task Definitions ======================= -->
112        <!--
113
114  These properties define custom tasks for the Ant build tool that interact
115  with the "/manager" web application installed with Tomcat 4.  Before they
116  can be successfully utilized, you must perform the following steps:
117
118  - Copy the file "server/lib/catalina-ant.jar" from your Tomcat 4
119    installation into the "lib" directory of your Ant installation.
120
121  - Create a "build.properties" file in your application's top-level
122    source directory (or your user login home directory) that defines
123    appropriate values for the "manager.password", "manager.url", and
124    "manager.username" properties described above.
125
126  For more information about the Manager web application, and the functionality
127  of these tasks, see <http://localhost:8080/tomcat-docs/manager-howto.html>.
128
129-->
130        <taskdef name="install" classname="org.apache.catalina.ant.InstallTask"/>
131        <taskdef name="list" classname="org.apache.catalina.ant.ListTask"/>
132        <taskdef name="reload" classname="org.apache.catalina.ant.ReloadTask"/>
133        <taskdef name="remove" classname="org.apache.catalina.ant.RemoveTask"/>
134        <!--  ==================== Compilation Control Options ==================== -->
135        <!--
136
137  These properties control option settings on the Javac compiler when it
138  is invoked using the <javac> task.
139
140  compile.debug        Should compilation include the debug option?
141
142  compile.deprecation  Should compilation include the deprecation option?
143
144  compile.optimize     Should compilation include the optimize option?
145
146-->
147        <property name="compile.debug" value="true"/>
148        <property name="compile.deprecation" value="false"/>
149        <property name="compile.optimize" value="true"/>
150        <!-- ==================== External Dependencies =========================== -->
151        <!--
152
153  Use property values to define the locations of external JAR files on which
154  your application will depend.  In general, these values will be used for
155  two purposes:
156  * Inclusion on the classpath that is passed to the Javac compiler
157  * Being copied into the "/WEB-INF/lib" directory during execution
158    of the "deploy" target.
159
160  Because we will automatically include all of the Java classes that Tomcat 4
161  exposes to web applications, we will not need to explicitly list any of those
162  dependencies.  You only need to worry about external dependencies for JAR
163  files that you are going to include inside your "/WEB-INF/lib" directory.
164
165-->
166        <!-- Dummy external dependency -->
167        <!--
168  <property name="foo.jar"
169           value="/path/to/foo.jar"/>
170-->
171        <!-- ==================== Compilation Classpath =========================== -->
172        <!--
173
174  Rather than relying on the CLASSPATH environment variable, Ant includes
175  features that makes it easy to dynamically construct the classpath you
176  need for each compilation.  The example below constructs the compile
177  classpath to include the servlet.jar file, as well as the other components
178  that Tomcat makes available to web applications automatically, plus anything
179  that you explicitly added.
180
181-->
182        <path id="compile.classpath">
183                <!-- Include all JAR files that will be included in /WEB-INF/lib -->
184                <!-- *** CUSTOMIZE HERE AS REQUIRED BY YOUR APPLICATION *** -->
185                <!--
186    <pathelement location="${foo.jar}"/>
187-->
188                <fileset dir="${basedir}/web/WEB-INF/lib">
189                        <include name="*.jar"/>
190                </fileset>
191                <!-- Include all elements that Tomcat exposes to applications -->
192                <pathelement location="${catalina.home}/common/classes"/>
193                <fileset dir="${catalina.home}/common/endorsed">
194                        <include name="*.jar"/>
195                </fileset>
196                <fileset dir="${catalina.home}/common/lib">
197                        <include name="*.jar"/>
198                </fileset>
199                <pathelement location="${catalina.home}/shared/classes"/>
200                <fileset dir="${catalina.home}/shared/lib">
201                        <include name="*.jar"/>
202                </fileset>
203        </path>
204        <!-- ==================== All Target ====================================== -->
205        <!--
206
207  The "all" target is a shortcut for running the "clean" target followed
208  by the "compile" target, to force a complete recompile.
209
210-->
211        <target name="all" depends="clean,compile" description="Clean build and dist directories, then compile"/>
212        <!-- ==================== Clean Target ==================================== -->
213        <!--
214
215  The "clean" target deletes any previous "build" and "dist" directory,
216  so that you can be ensured the application can be built from scratch.
217
218-->
219        <target name="clean" description="Delete old build and dist directories">
220                <delete dir="${build.home}"/>
221                <delete dir="${dist.home}"/>
222        </target>
223        <!-- ==================== Compile Target ================================== -->
224        <!--
225
226  The "compile" target transforms source files (from your "src" directory)
227  into object files in the appropriate location in the build directory.
228  This example assumes that you will be including your classes in an
229  unpacked directory hierarchy under "/WEB-INF/classes".
230
231-->
232        <target name="compile" depends="prepare" description="Compile Java sources">
233                <!-- Compile Java classes as necessary -->
234                <mkdir dir="${build.home}/WEB-INF/classes"/>
235                <javac srcdir="${src.home}" destdir="${build.home}/WEB-INF/classes" debug="${compile.debug}" source="1.4" deprecation="${compile.deprecation}" optimize="${compile.optimize}">
236                        <classpath refid="compile.classpath"/>
237                </javac>
238                <!-- Copy application resources -->
239                <copy todir="${build.home}/WEB-INF/classes">
240                        <fileset dir="${src.home}" excludes="**/*.java"/>
241                </copy>
242        </target>
243        <!-- ==================== Dist Target ===================================== -->
244        <!--
245
246  The "dist" target creates a binary distribution of your application
247  in a directory structure ready to be archived in a tar.gz or zip file.
248  Note that this target depends on two others:
249
250  * "compile" so that the entire web application (including external
251    dependencies) will have been assembled
252
253  * "javadoc" so that the application Javadocs will have been created
254
255-->
256        <target name="dist" depends="compile,javadoc" description="Create binary distribution">
257                <!-- Copy documentation subdirectories -->
258                <mkdir dir="${dist.home}/docs"/>
259                <copy todir="${dist.home}/docs">
260                        <fileset dir="${docs.home}"/>
261                </copy>
262                <!-- Create application JAR file -->
263                <jar jarfile="${dist.home}/${app.name}-${app.version}.war" basedir="${build.home}"/>
264                <!-- Copy additional files to ${dist.home} as necessary -->
265        </target>
266        <!-- ==================== Install Target ================================== -->
267        <!--
268
269  The "install" target tells the specified Tomcat 4 installation to dynamically
270  install this web application and make it available for execution.  It does
271  *not* cause the existence of this web application to be remembered across
272  Tomcat restarts; if you restart the server, you will need to re-install all
273  this web application.
274
275  If you have already installed this application, and simply want Tomcat to
276  recognize that you have updated Java classes (or the web.xml file), use the
277  "reload" target instead.
278
279  NOTE:  This target will only succeed if it is run from the same server that
280  Tomcat is running on.
281
282  NOTE:  This is the logical opposite of the "remove" target.
283
284-->
285        <target name="install" depends="compile" description="Install application to servlet container">
286                <install url="${manager.url}" username="${manager.username}" password="${manager.password}" path="${app.path}" war="file://${build.home}"/>
287        </target>
288        <!-- ==================== Javadoc Target ================================== -->
289        <!--
290
291  The "javadoc" target creates Javadoc API documentation for the Java
292  classes included in your application.  Normally, this is only required
293  when preparing a distribution release, but is available as a separate
294  target in case the developer wants to create Javadocs independently.
295
296-->
297        <target name="javadoc" depends="compile" description="Create Javadoc API documentation">
298                <mkdir dir="${dist.home}/docs/api"/>
299                <javadoc sourcepath="${src.home}" destdir="${dist.home}/docs/api" packagenames="*">
300                        <classpath refid="compile.classpath"/>
301                </javadoc>
302        </target>
303        <!-- ====================== List Target =================================== -->
304        <!--
305
306  The "list" target asks the specified Tomcat 4 installation to list the
307  currently running web applications, either loaded at startup time or
308  installed dynamically.  It is useful to determine whether or not the
309  application you are currently developing has been installed.
310
311-->
312        <target name="list" description="List installed applications on servlet container">
313                <list url="${manager.url}" username="${manager.username}" password="${manager.password}"/>
314        </target>
315        <!-- ==================== Prepare Target ================================== -->
316        <!--
317
318  The "prepare" target is used to create the "build" destination directory,
319  and copy the static contents of your web application to it.  If you need
320  to copy static files from external dependencies, you can customize the
321  contents of this task.
322
323  Normally, this task is executed indirectly when needed.
324
325-->
326        <target name="prepare">
327                <!-- Create build directories as needed -->
328                <mkdir dir="${build.home}"/>
329                <mkdir dir="${build.home}/WEB-INF"/>
330                <mkdir dir="${build.home}/WEB-INF/classes"/>
331                <!-- Copy static content of this web application -->
332                <copy todir="${build.home}">
333                        <fileset dir="${web.home}"/>
334                </copy>
335                <!-- Copy external dependencies as required -->
336                <!-- *** CUSTOMIZE HERE AS REQUIRED BY YOUR APPLICATION *** -->
337                <mkdir dir="${build.home}/WEB-INF/lib"/>
338                <copy todir="${build.home}/WEB-INF/lib">
339                        <fileset dir="${basedir}/web/WEB-INF/lib"/>
340                </copy>
341                <!--
342   
343-->
344                <!-- Copy static files from external dependencies as needed -->
345                <!-- *** CUSTOMIZE HERE AS REQUIRED BY YOUR APPLICATION *** -->
346        </target>
347        <!-- ==================== Reload Target =================================== -->
348        <!--
349
350  The "reload" target tells the specified Tomcat 4 installation to dynamically
351  reload this web application, to reflect changes in the underlying classes or
352  the "web.xml" deployment descriptor.
353
354-->
355        <target name="reload" depends="compile" description="Reload application on servlet container">
356                <reload url="${manager.url}" username="${manager.username}" password="${manager.password}" path="${app.path}"/>
357        </target>
358        <!-- ==================== Remove Target =================================== -->
359        <!--
360
361  The "remove" target tells the specified Tomcat 4 installation to dynamically
362  remove this web application from service.
363
364  NOTE:  This is the logical opposite of the "install" target.
365
366-->
367        <target name="remove" description="Remove application on servlet container">
368                <remove url="${manager.url}" username="${manager.username}" password="${manager.password}" path="${app.path}"/>
369        </target>
370        <!--
371        compiles and reloads
372       
373        -->
374</project>
Note: See TracBrowser for help on using the repository browser.