source: trunk/gsdl3/extensions/gsdl-as/build.xml@ 8738

Last change on this file since 8738 was 8738, checked in by schweer, 19 years ago

user authentication works; user information and subscriptions/predicates are stored to thedatabase

  • Property svn:keywords set to Author Date Id Revision
File size: 16.8 KB
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: build.xml 8738 2004-12-05 22:44:03Z schweer $
22-->
23
24
25<!-- A "project" describes a set of targets that may be requested
26 when Ant is executed. The "default" attribute defines the
27 target which is executed if no specific target is requested,
28 and the "basedir" attribute defines the current working directory
29 from which Ant executes the requested task. This is normally
30 set to the current working directory.
31-->
32
33<project name="GSDL Alerting Service" default="compile" basedir=".">
34
35
36
37<!-- ===================== Property Definitions =========================== -->
38
39
40<!--
41
42 Each of the following properties are used in the build script.
43 Values for these properties are set by the first place they are
44 defined, from the following list:
45
46 * Definitions on the "ant" command line (ant -Dfoo=bar compile).
47
48 * Definitions from a "build.properties" file in the top level
49 source directory of this application.
50
51 * Definitions from a "build.properties" file in the developer's
52 home directory.
53
54 * Default definitions in this build.xml file.
55
56 You will note below that property values can be composed based on the
57 contents of previously defined properties. This is a powerful technique
58 that helps you minimize the number of changes required when your development
59 environment is modified. Note that property composition is allowed within
60 "build.properties" files as well as in the "build.xml" script.
61
62-->
63
64 <property file="build.properties"/>
65 <property file="${user.home}/build.properties"/>
66
67
68<!-- ==================== File and Directory Names ======================== -->
69
70
71<!--
72
73 These properties generally define file and directory names (or paths) that
74 affect where the build process stores its outputs.
75
76 app.name Base name of this application, used to
77 construct filenames and directories.
78 Defaults to "myapp".
79
80 app.path Context path to which this application should be
81 deployed (defaults to "/" plus the value of the
82 "app.name" property).
83
84 app.version Version number of this iteration of the application.
85
86 build.home The directory into which the "prepare" and
87 "compile" targets will generate their output.
88 Defaults to "build".
89
90 catalina.home The directory in which you have installed
91 a binary distribution of Tomcat 4. This will
92 be used by the "deploy" target.
93
94 dist.home The name of the base directory in which
95 distribution files are created.
96 Defaults to "dist".
97
98 manager.password The login password of a user that is assigned the
99 "manager" role (so that he or she can execute
100 commands via the "/manager" web application)
101
102 manager.url The URL of the "/manager" web application on the
103 Tomcat installation to which we will deploy web
104 applications and web services.
105
106 manager.username The login username of a user that is assigned the
107 "manager" role (so that he or she can execute
108 commands via the "/manager" web application)
109
110-->
111
112 <property name="app.name" value="gsdl-as"/>
113 <property name="app.path" value="/alerting"/>
114 <property name="app.version" value="0.1-dev"/>
115 <property name="build.home" value="${basedir}/build"/>
116 <property name="catalina.home" value="../../comms/jakarta/tomcat/"/>
117 <property name="dist.home" value="${basedir}/dist"/>
118 <property name="docs.home" value="${basedir}/docs"/>
119 <property name="docs.link" value="http://java.sun.com/j2se/1.4.2/docs/api/"/>
120 <property name="manager.url" value="http://localhost:8080/manager"/>
121 <property name="manager.username" value="admin"/>
122 <property name="manager.password" value="admin"/>
123 <property name="src.home" value="${basedir}/src"/>
124 <property name="web.home" value="${basedir}/web"/>
125
126
127<!-- ================== Custom Ant Task Definitions ======================= -->
128
129
130<!--
131
132 These properties define custom tasks for the Ant build tool that interact
133 with the "/manager" web application installed with Tomcat 4. Before they
134 can be successfully utilized, you must perform the following steps:
135
136 - Copy the file "server/lib/catalina-ant.jar" from your Tomcat 4
137 installation into the "lib" directory of your Ant installation.
138
139 - Create a "build.properties" file in your application's top-level
140 source directory (or your user login home directory) that defines
141 appropriate values for the "manager.password", "manager.url", and
142 "manager.username" properties described above.
143
144 For more information about the Manager web application, and the functionality
145 of these tasks, see <http://localhost:8080/tomcat-docs/manager-howto.html>.
146
147-->
148
149 <taskdef name="install" classname="org.apache.catalina.ant.InstallTask"/>
150 <taskdef name="list" classname="org.apache.catalina.ant.ListTask"/>
151 <taskdef name="reload" classname="org.apache.catalina.ant.ReloadTask"/>
152 <taskdef name="remove" classname="org.apache.catalina.ant.RemoveTask"/>
153
154
155<!-- ==================== Compilation Control Options ==================== -->
156
157<!--
158
159 These properties control option settings on the Javac compiler when it
160 is invoked using the <javac> task.
161
162 compile.debug Should compilation include the debug option?
163
164 compile.deprecation Should compilation include the deprecation option?
165
166 compile.optimize Should compilation include the optimize option?
167
168-->
169
170 <property name="compile.debug" value="true"/>
171 <property name="compile.deprecation" value="false"/>
172 <property name="compile.optimize" value="true"/>
173
174
175
176<!-- ==================== External Dependencies =========================== -->
177
178
179<!--
180
181 Use property values to define the locations of external JAR files on which
182 your application will depend. In general, these values will be used for
183 two purposes:
184 * Inclusion on the classpath that is passed to the Javac compiler
185 * Being copied into the "/WEB-INF/lib" directory during execution
186 of the "deploy" target.
187
188 Because we will automatically include all of the Java classes that Tomcat 4
189 exposes to web applications, we will not need to explicitly list any of those
190 dependencies. You only need to worry about external dependencies for JAR
191 files that you are going to include inside your "/WEB-INF/lib" directory.
192
193-->
194
195<!-- Dummy external dependency -->
196<!--
197 <property name="foo.jar"
198 value="/path/to/foo.jar"/>
199-->
200
201
202<!-- ==================== Compilation Classpath =========================== -->
203
204<!--
205
206 Rather than relying on the CLASSPATH environment variable, Ant includes
207 features that makes it easy to dynamically construct the classpath you
208 need for each compilation. The example below constructs the compile
209 classpath to include the servlet.jar file, as well as the other components
210 that Tomcat makes available to web applications automatically, plus anything
211 that you explicitly added.
212
213-->
214
215 <path id="compile.classpath">
216
217 <!-- Include all JAR files that will be included in /WEB-INF/lib -->
218 <!-- *** CUSTOMIZE HERE AS REQUIRED BY YOUR APPLICATION *** -->
219 <fileset dir="lib">
220 <include name="*.jar"/>
221 </fileset>
222
223 <!-- Include all elements that Tomcat exposes to applications -->
224 <pathelement location="${catalina.home}/common/classes"/>
225 <fileset dir="${catalina.home}/common/endorsed">
226 <include name="*.jar"/>
227 </fileset>
228 <fileset dir="${catalina.home}/common/lib">
229 <include name="*.jar"/>
230 </fileset>
231 <pathelement location="${catalina.home}/shared/classes"/>
232 <fileset dir="${catalina.home}/shared/lib">
233 <include name="*.jar"/>
234 </fileset>
235
236 </path>
237
238
239
240<!-- ==================== All Target ====================================== -->
241
242<!--
243
244 The "all" target is a shortcut for running the "clean" target followed
245 by the "compile" target, to force a complete recompile.
246
247-->
248
249 <target name="all" depends="clean,compile"
250 description="Clean build and dist directories, then compile"/>
251
252
253
254<!-- ==================== Clean Target ==================================== -->
255
256<!--
257
258 The "clean" target deletes any previous "build" and "dist" directory,
259 so that you can be ensured the application can be built from scratch.
260
261-->
262
263 <target name="clean"
264 description="Delete old build and dist directories">
265 <delete dir="${build.home}"/>
266 <delete dir="${dist.home}"/>
267 </target>
268
269
270
271<!-- ==================== Compile Target ================================== -->
272
273<!--
274
275 The "compile" target transforms source files (from your "src" directory)
276 into object files in the appropriate location in the build directory.
277 This example assumes that you will be including your classes in an
278 unpacked directory hierarchy under "/WEB-INF/classes".
279
280-->
281
282 <target name="compile" depends="prepare"
283 description="Compile Java sources">
284
285 <!-- Compile Java classes as necessary -->
286 <mkdir dir="${build.home}/WEB-INF/classes"/>
287 <javac srcdir="${src.home}"
288 destdir="${build.home}/WEB-INF/classes"
289 debug="${compile.debug}"
290 deprecation="${compile.deprecation}"
291 optimize="${compile.optimize}">
292 <classpath refid="compile.classpath"/>
293 </javac>
294
295 <!-- Copy application resources -->
296 <copy todir="${build.home}/WEB-INF/classes">
297 <fileset dir="${src.home}" excludes="**/*.java"/>
298 </copy>
299
300 </target>
301
302
303
304<!-- ==================== Dist Target ===================================== -->
305
306
307<!--
308
309 The "dist" target creates a binary distribution of your application
310 in a directory structure ready to be archived in a tar.gz or zip file.
311 Note that this target depends on two others:
312
313 * "compile" so that the entire web application (including external
314 dependencies) will have been assembled
315
316 * "javadoc" so that the application Javadocs will have been created
317
318-->
319
320 <target name="dist" depends="compile,javadoc"
321 description="Create binary distribution">
322
323 <!-- Copy documentation subdirectories -->
324 <mkdir dir="${dist.home}/docs"/>
325 <copy todir="${dist.home}/docs">
326 <fileset dir="${docs.home}"/>
327 </copy>
328
329 <!-- Create application JAR file -->
330 <jar jarfile="${dist.home}/${app.name}-${app.version}.war"
331 basedir="${build.home}"/>
332
333 <!-- Copy additional files to ${dist.home} as necessary -->
334
335 </target>
336
337
338
339<!-- ==================== Install Target ================================== -->
340
341<!--
342
343 The "install" target tells the specified Tomcat 4 installation to dynamically
344 install this web application and make it available for execution. It does
345 *not* cause the existence of this web application to be remembered across
346 Tomcat restarts; if you restart the server, you will need to re-install all
347 this web application.
348
349 If you have already installed this application, and simply want Tomcat to
350 recognize that you have updated Java classes (or the web.xml file), use the
351 "reload" target instead.
352
353 NOTE: This target will only succeed if it is run from the same server that
354 Tomcat is running on.
355
356 NOTE: This is the logical opposite of the "remove" target.
357
358-->
359
360 <target name="install" depends="compile"
361 description="Install application to servlet container">
362
363 <install url="${manager.url}"
364 username="${manager.username}"
365 password="${manager.password}"
366 path="${app.path}"
367 war="file://${build.home}"/>
368
369 </target>
370
371
372<!-- ==================== Javadoc Target ================================== -->
373
374<!--
375
376 The "javadoc" target creates Javadoc API documentation for the Java
377 classes included in your application. Normally, this is only required
378 when preparing a distribution release, but is available as a separate
379 target in case the developer wants to create Javadocs independently.
380
381-->
382
383 <target name="javadoc" depends="compile"
384 description="Create Javadoc API documentation">
385
386 <mkdir dir="${dist.home}/docs/api"/>
387 <javadoc sourcepath="${src.home}"
388 destdir="${dist.home}/docs/api"
389 link="${docs.link}"
390 private="true"
391 packagenames="*">
392 <classpath refid="compile.classpath"/>
393 </javadoc>
394
395 </target>
396
397
398
399<!-- ====================== List Target =================================== -->
400
401<!--
402
403 The "list" target asks the specified Tomcat 4 installation to list the
404 currently running web applications, either loaded at startup time or
405 installed dynamically. It is useful to determine whether or not the
406 application you are currently developing has been installed.
407
408-->
409
410 <target name="list"
411 description="List installed applications on servlet container">
412
413 <list url="${manager.url}"
414 username="${manager.username}"
415 password="${manager.password}"/>
416
417 </target>
418
419
420<!-- ==================== Prepare Target ================================== -->
421
422<!--
423
424 The "prepare" target is used to create the "build" destination directory,
425 and copy the static contents of your web application to it. If you need
426 to copy static files from external dependencies, you can customize the
427 contents of this task.
428
429 Normally, this task is executed indirectly when needed.
430
431-->
432
433 <target name="prepare">
434
435 <!-- Create build directories as needed -->
436 <mkdir dir="${build.home}"/>
437 <mkdir dir="${build.home}/WEB-INF"/>
438 <mkdir dir="${build.home}/WEB-INF/classes"/>
439
440
441 <!-- Copy static content of this web application -->
442 <copy todir="${build.home}">
443 <fileset dir="${web.home}"/>
444 </copy>
445
446 <jar destfile="lib/templates.jar" basedir="lib/templates" includes="*.vm"/>
447
448 <!-- Copy external dependencies as required -->
449 <!-- *** CUSTOMIZE HERE AS REQUIRED BY YOUR APPLICATION *** -->
450 <mkdir dir="${build.home}/WEB-INF/lib"/>
451 <copy todir="${build.home}/WEB-INF/lib">
452 <fileset dir="lib" includes="*.jar"/>
453 </copy>
454
455 <!-- Copy static files from external dependencies as needed -->
456 <!-- *** CUSTOMIZE HERE AS REQUIRED BY YOUR APPLICATION *** -->
457
458 </target>
459
460
461<!-- ==================== Reload Target =================================== -->
462
463<!--
464
465 The "reload" signals the specified application Tomcat 4 to shut itself down
466 and reload. This can be useful when the web application context is not
467 reloadable and you have updated classes or property files in the
468 /WEB-INF/classes directory or when you have added or updated jar files in the
469 /WEB-INF/lib directory.
470
471 NOTE: The /WEB-INF/web.xml web application configuration file is not reread
472 on a reload. If you have made changes to your web.xml file you must stop
473 then start the web application.
474
475-->
476
477 <target name="reload" depends="compile"
478 description="Reload application on servlet container">
479
480 <reload url="${manager.url}"
481 username="${manager.username}"
482 password="${manager.password}"
483 path="${app.path}"/>
484
485 </target>
486
487
488<!-- ==================== Remove Target =================================== -->
489
490<!--
491
492 The "remove" target tells the specified Tomcat 4 installation to dynamically
493 remove this web application from service.
494
495 NOTE: This is the logical opposite of the "install" target.
496
497-->
498
499 <target name="remove"
500 description="Remove application on servlet container">
501
502 <remove url="${manager.url}"
503 username="${manager.username}"
504 password="${manager.password}"
505 path="${app.path}"/>
506
507 </target>
508
509
510</project>
Note: See TracBrowser for help on using the repository browser.