root/branches/douglm/build/buildwar.xml

Revision 2291 (checked in by douglm, 4 years ago)

Simplify notification classes and implement a jms notifications handler.

This requires activemq to be running

Line 
1 <?xml version="1.0"?>
2
3 <!-- ===================================================================
4      This file is called by other build files to create web applications.
5
6      It is assumed that no changes will be made to this file. It should be
7      possible to make all changes needed by modifying the configuration
8      properties or a bedework.build.proeprties file
9
10      An unwrapped web application will be built in the temp directory
11      and a war and ear file will be left in the dist directory.
12
13      Properties which must be defined on entry, apart from those described
14      in the main build file are:
15     app.root.dir       Location of the root directory for the apps
16     app.sou.dir        Location of the application skeleton,
17     app.name           Name of the application. This wil be used to determine
18                        the name of the file containing the rest of the
19                        application properties, the directory we build in
20                        and the name of war and ear files.
21      These should be defined in the build properties for the application.
22
23      It is possible to define any of the app.dest properties below to override
24      the location of destination files.
25
26      In the directory
27         ${apps.sou.dir}
28      we expect an application skeleton formatted like a web-application
29      For the purposes of this build it should contain a
30      structure like
31               war - docs    (contains jsp and html for this app)
32                     WEB-INF - struts-config.xml
33                               web.xml
34                               jboss-web.xml (for jboss only)
35
36      Authors: Mike Douglass
37      =================================================================== -->
38
39 <project name="bedework.buildwar" default="build" >
40   <import file="${build.dir}/buildfilters.xml" />
41
42   <if>
43     <isset property="org.bedework.global.portal.platform" />
44     <then>
45       <import file="${build.dir}/portals/${org.bedework.global.portal.platform}War.xml" />
46     </then>
47   </if>
48
49   <import file="${build.dir}/platforms/${org.bedework.global.deploy.platform}War.xml" />
50
51   <target name="init" depends="init.common">
52     <if>
53       <isset property="org.bedework.global.build.ear" />
54       <then>
55         <!-- Common library in ear file -->
56         <property name="app.dest.lib"
57                   location="${org.bedework.ear.templib}" />
58
59         <!-- Properties all go into a single jar file at termination -->
60         <property name="app.dest.classes"
61                   location="${org.bedework.ear.properties.dir}" />
62       </then>
63       <else>
64         <!-- Library in war file -->
65         <property name="app.dest.lib"
66                   location="${app.dest.webinf}/lib" />
67
68         <!-- Properties in the war file -->
69         <property name="app.dest.classes"
70                   location="${app.dest.webinf}/classes" />
71       </else>
72     </if>
73     <property name="app.dest.properties.old"
74               location="${app.dest.classes}/properties/calendar" />
75     <property name="app.dest.properties"
76               location="${app.dest.classes}/properties" />
77   </target>
78
79   <target name="init.common">
80     <!-- Destinations - where we build an unwrapped war -->
81     <property name="app.dest.war"
82               location="${org.bedework.temp.wars.home}/${propval.app.war.name}.war" />
83     <property name="app.dest.docs"
84               location="${app.dest.war}/docs" />
85     <property name="app.dest.webinf"
86               location="${app.dest.war}/WEB-INF" />
87     <property name="app.dest.metainf"
88               location="${app.dest.war}/META-INF" />
89
90     <!--temp web.xml location  -->
91     <property name="app.temp.web.xml"
92               location="${app.dest.webinf}/tempweb.xml" />
93
94     <!--final web.xml location  -->
95     <property name="app.dest.web.xml"
96               location="${app.dest.webinf}/web.xml" />
97
98     <property name="app.war.file"
99               location="${dist.home}/${propval.app.war.name}.war" />
100
101     <!-- default web.xml -->
102     <property name="propval.app.web.xml"
103               value="war/WEB-INF/web.xml" />
104
105               <!--
106     <property name="app.web.xml"
107               location="${propval.app.web.xml}" />
108               -->
109     <resolveFile name="app.web.xml"
110                  file="${propval.app.web.xml}"
111                  base="${app.sou.dir}"/>
112
113     <property name="app.sou.properties"
114               location="${app.sou.dir}/war/WEB-INF/classes/servlet.properties" />
115   </target>
116
117   <target name="build" depends="init">
118     <echo message="**************************************************" />
119     <echo message=" * Building war ${propval.app.war.name}"/>
120     <echo message="**************************************************" />
121
122     <delete dir="${app.dest.war}" />
123
124     <!-- Add modifed login pages -->
125     <copy todir="${app.dest.docs}/login" failonerror="false" >
126       <fileset dir="${org.bedework.common.resources}/login" />
127       <filterset>
128         <filter token="DISPLAY-NAME" value="${propval.app.display.name}"/>
129       </filterset>
130     </copy>
131
132     <!-- ===============================================================
133          We copy 3 sets of properties.
134
135          First (for struts) are the servlet properties which ends up as
136               classes/servlet.properties
137          Next we copy in a set of generic property files and then with
138          overwrite we copy in a set of base specific files.
139
140          All are updated with new values.
141          =============================================================== -->
142
143     <if>
144       <available file="${app.sou.dir}/war/docs" type="dir" />
145       <then>
146         <copy todir="${app.dest.docs}">
147           <fileset dir="${app.sou.dir}/war/docs" />
148         </copy>
149       </then>
150     </if>
151
152     <!-- ===============================================================
153          Any property files we need for configuration, other than the
154          standard struts file, should be in the "${app.sou.dir}/properties
155          directory. They will be copied into the appropriate place for the
156          war and transformed by the above filter.
157          =============================================================== -->
158
159     <!-- Create the runtime options file -->
160     <mkdir dir="${app.dest.properties}" />
161
162     <if>
163       <available file="${app.sou.dir}/properties" type="dir" />
164       <then>
165         <copy todir="${app.dest.properties}" overwrite="yes" >
166           <fileset dir="${app.sou.dir}/properties"
167                    includes="*.properties"/>
168           <filterset refid="property.filters" />
169         </copy>
170       </then>
171     </if>
172
173     <copy tofile="${app.dest.properties}/options.xml"
174           file="${org.bedework.config.options}" >
175       <filterset>
176         <filter token="RPI-DEBUG" value="${app.debug.val}"/>
177       </filterset>
178       <filterset refid="property.filters" />
179     </copy>
180
181         <!-- Temp do it again -->
182     <mkdir dir="${app.dest.properties.old}" />
183
184     <copy tofile="${app.dest.properties.old}/options.xml"
185           file="${org.bedework.config.options}" >
186       <filterset>
187         <filter token="RPI-DEBUG" value="${app.debug.val}"/>
188       </filterset>
189       <filterset refid="property.filters" />
190     </copy>
191
192     <copy todir="${app.dest.classes}">
193       <fileset dir="${app.sou.dir}/war/WEB-INF/classes"
194                includes="*"/>
195       <filterset refid="property.filters" />
196     </copy>
197
198     <copy tofile="${app.dest.classes}/servlet.properties" file="${app.sou.properties}">
199       <filterset refid="property.filters" />
200     </copy>
201
202     <!-- ===============================================================
203          Add hibernate jars and property files from calendar api.
204          =============================================================== -->
205
206     <copy todir="${app.dest.classes}">
207       <fileset dir="${org.bedework.project.calendarapi}/calCore/resources/properties" />
208       <filterset refid="property.filters" />
209     </copy>
210
211     <copy todir="${app.dest.classes}">
212       <fileset dir="${org.bedework.project.calendarapi}/calCore/resources/hbms" />
213       <filterset refid="property.filters" />
214     </copy>
215
216     <!-- Make a temp copy of the web.xml file -->
217     <copy tofile="${app.temp.web.xml}" file="${app.web.xml}"
218           overwrite="yes" />
219
220     <antcall target="struts-stuff" inheritRefs="true" />
221
222     <!-- Filter the temp copy of the web.xml file -->
223     <copy tofile="${app.dest.web.xml}"
224           file="${app.temp.web.xml}"
225           overwrite="yes" >
226       <filterset>
227         <filter token="RPI-DEBUG" value="${app.debug.val}"/>
228       </filterset>
229       <filterset refid="property.filters" />
230     </copy>
231
232     <delete file="${app.temp.web.xml}" />
233
234     <!-- Add the contex root to the file. Note that newline is required -->
235     <echo file="${org.bedework.global.context.roots}" append="yes">
236 ${propval.app.war.name}.context=${propval.app.context.root}
237     </echo>
238
239     <copy todir="${app.dest.lib}" file="${org.bedework.appjar.antlr}" />
240     <copy todir="${app.dest.lib}" file="${org.bedework.appjar.asm-attrs}" />
241     <copy todir="${app.dest.lib}" file="${org.bedework.appjar.asm}" />
242     <copy todir="${app.dest.lib}" file="${org.bedework.appjar.cglib}" />
243     <copy todir="${app.dest.lib}" file="${org.bedework.appjar.dom4j}" />
244     <copy todir="${app.dest.lib}" file="${org.bedework.appjar.ehcache}" />
245     <copy todir="${app.dest.lib}" file="${org.bedework.appjar.hibernate}" />
246     <copy todir="${app.dest.lib}" file="${org.bedework.appjar.javassist}" />
247     <copy todir="${app.dest.lib}" file="${org.bedework.appjar.jgroups}" />
248     <copy todir="${app.dest.lib}" file="${org.bedework.appjar.jta}" />
249     <copy todir="${app.dest.lib}" file="${org.bedework.appjar.slf4j-api}" />
250     <copy todir="${app.dest.lib}" file="${org.bedework.appjar.slf4j-log4j12}" />
251
252         <!-- jms support -->
253     <copy todir="${app.dest.lib}" file="${org.bedework.appjar.activemq-core}" />
254     <copy todir="${app.dest.lib}"
255             file="${org.bedework.appjar.geronimo-j2ee-management_1.0_spec}" />
256     <copy todir="${app.dest.lib}" file="${org.bedework.appjar.jms}" />
257
258     <antcall target="bexchange-stuff" inheritRefs="true" />
259     <antcall target="domino-stuff" inheritRefs="true" />
260     <antcall target="google-stuff" inheritRefs="true" />
261
262     <!-- ===============================================================
263          Any jar files required
264          =============================================================== -->
265
266     <echo message="+++++++++++  bw-logging at ${org.bedework.appjar.bw-logging}" />
267     <copy todir="${app.dest.lib}" file="${org.bedework.appjar.bw-annotations}" />
268     <copy todir="${app.dest.lib}" file="${org.bedework.appjar.rpiaccess}" />
269     <copy todir="${app.dest.lib}" file="${org.bedework.appjar.rpiutil}" />
270     <copy todir="${app.dest.lib}" file="${org.bedework.appjar.bw-davio}" />
271     <copy todir="${app.dest.lib}" file="${org.bedework.appjar.bw-apiutil}" />
272     <copy todir="${app.dest.lib}" file="${org.bedework.appjar.bw-calcore}" />
273     <copy todir="${app.dest.lib}" file="${org.bedework.appjar.bw-calcorei}" />
274     <copy todir="${app.dest.lib}" file="${org.bedework.appjar.bw-calfacade}" />
275     <copy todir="${app.dest.lib}" file="${org.bedework.appjar.bw-calsvc}" />
276     <copy todir="${app.dest.lib}" file="${org.bedework.appjar.bw-calsvci}" />
277     <copy todir="${app.dest.lib}" file="${org.bedework.appjar.bw-client}" />
278     <copy todir="${app.dest.lib}" file="${org.bedework.appjar.bw-icalendar}" />
279     <copy todir="${app.dest.lib}" file="${org.bedework.appjar.bw-logging}" />
280     <copy todir="${app.dest.lib}" file="${org.bedework.appjar.bw-mail}" />
281     <copy todir="${app.dest.lib}" file="${org.bedework.appjar.bw-sysevents}" />
282     <copy todir="${app.dest.lib}" file="${org.bedework.appjar.bw-appcommon}" />
283
284     <copy todir="${app.dest.lib}" file="${org.bedework.appjar.lucene-core}"/>
285     <copy todir="${app.dest.lib}" file="${org.bedework.appjar.lucene-misc}"/>
286     <copy todir="${app.dest.lib}" file="${org.bedework.appjar.ical4j}"/>
287     <copy todir="${app.dest.lib}" file="${org.bedework.appjar.commons-codec}"/>
288     <copy todir="${app.dest.lib}" file="${org.bedework.appjar.commons-collections}"/>
289     <copy todir="${app.dest.lib}" file="${org.bedework.appjar.commons-httpclient}"/>
290     <copy todir="${app.dest.lib}" file="${org.bedework.appjar.commons-lang}"/>
291     <copy todir="${app.dest.lib}" file="${org.bedework.appjar.commons-ssl}"/>
292
293     <!-- Mail related stuff -->
294     <copy todir="${app.dest.lib}" file="${org.bedework.appjar.activation}" />
295     <copy todir="${app.dest.lib}" file="${org.bedework.appjar.dsn}" />
296     <copy todir="${app.dest.lib}" file="${org.bedework.appjar.imap}" />
297     <copy todir="${app.dest.lib}" file="${org.bedework.appjar.mailapi}" />
298     <copy todir="${app.dest.lib}" file="${org.bedework.appjar.pop3}" />
299     <copy todir="${app.dest.lib}" file="${org.bedework.appjar.smtp}" />
300
301     <!-- any extra files-->
302     <copy todir="${app.dest.lib}" >
303       <fileset dir="${org.bedework.temp.extrajars.dir}" />
304     </copy>
305
306     <!-- Platform specific -->
307     <antcall target="doPlatform" inheritRefs="true" />
308
309     <!-- build the war file -->
310     <mkdir dir="${dist.home}" />
311     <delete file="${app.war.file}" />
312
313     <war warfile="${app.war.file}"
314          webxml="${app.dest.web.xml}"
315          basedir="${app.dest.war}"
316          excludes="WEB-INF/web.xml" />
317   </target>
318
319   <target name="bexchange-stuff" if="org.bedework.build.caldav.bexchange">
320   </target>
321
322   <target name="domino-stuff" if="org.bedework.build.caldav.domino">
323   </target>
324
325   <target name="google-stuff" if="org.bedework.build.caldav.google">
326     <copy todir="${app.dest.lib}">
327       <fileset dir="${google.dir}">
328         <include name="*.jar"/>
329       </fileset>
330     </copy>
331   </target>
332
333   <!-- =================================================================
334        If this is a struts app the following gets executed.
335        We create an updated struts-config.xml file and add some jars.
336        ================================================================= -->
337
338   <target name="struts-stuff" if="org.bedework.strutsapp">
339     <!-- Copy a dummy startup file into the war. -->
340     <copy todir="${app.dest.war}">
341       <fileset dir="${app.sou.dir}/war/" includes="setup.do" />
342     </copy>
343
344     <copy todir="${app.dest.webinf}"
345           file="${app.sou.dir}/war/WEB-INF/struts-config.xml"/>
346
347     <mkdir  dir="${app.dest.webinf}/tlds"/>
348     <copy todir="${app.dest.webinf}/tlds" >
349       <fileset dir="${org.bedework.struts.tlds}">
350         <include name="*"/>
351       </fileset>
352     </copy>
353
354     <if>
355       <isset property="org.bedework.global.portal.platform" />
356       <then>
357         <antcall target="doPortal" inheritRefs="true" />
358       </then>
359     </if>
360
361     <copy todir="${app.dest.lib}" file="${org.bedework.appjar.serializer}"/>
362     <copy todir="${app.dest.lib}" file="${org.bedework.appjar.xalan}"/>
363     <copy todir="${app.dest.lib}" file="${org.bedework.appjar.struts}"/>
364
365     <copy todir="${app.dest.lib}" file="${org.bedework.appjar.antlr}"/>
366     <copy todir="${app.dest.lib}" file="${org.bedework.appjar.commons-beanutils}"/>
367     <copy todir="${app.dest.lib}" file="${org.bedework.appjar.commons-digester}"/>
368     <copy todir="${app.dest.lib}" file="${org.bedework.appjar.commons-fileupload}"/>
369     <copy todir="${app.dest.lib}" file="${org.bedework.appjar.commons-logging}"/>
370     <copy todir="${app.dest.lib}" file="${org.bedework.appjar.commons-validator}"/>
371     <copy todir="${app.dest.lib}" file="${org.bedework.appjar.jakarta-oro}"/>
372     <copy todir="${app.dest.lib}" file="${org.bedework.appjar.jstl}"/>
373     <copy todir="${app.dest.lib}" file="${org.bedework.appjar.jstl-standard}"/>
374   </target>
375 </project>
Note: See TracBrowser for help on using the browser.