root/releases/bedework-3.6/build/buildwar.xml

Revision 2737 (checked in by douglm, 3 years ago)

Transfer all the changes which allow a jboss build of bedework.

Mostly build and deployment changes with a few mbean related changes for the outboard processes, dump/restore, indexer, in/outbox scheduler etc.

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         <!-- Properties all go into a single jar file at termination -->
56         <property name="app.dest.classes"
57                   location="${org.bedework.ear.properties.dir}" />
58       </then>
59       <else>
60         <!-- Properties in the war file -->
61         <property name="app.dest.classes"
62                   location="${app.dest.webinf}/classes" />
63       </else>
64     </if>
65     <property name="app.dest.properties.old"
66               location="${app.dest.classes}/properties/calendar" />
67     <property name="app.dest.properties"
68               location="${app.dest.classes}/properties" />
69   </target>
70
71   <target name="init.common">
72     <!-- Destinations - where we build an unwrapped war -->
73     <property name="app.dest.war"
74               location="${org.bedework.temp.wars.home}/${propval.app.war.name}.war" />
75     <property name="app.dest.docs"
76               location="${app.dest.war}/docs" />
77     <property name="app.dest.webinf"
78               location="${app.dest.war}/WEB-INF" />
79     <property name="app.dest.metainf"
80               location="${app.dest.war}/META-INF" />
81
82     <!--temp web.xml location  -->
83     <property name="app.temp.web.xml"
84               location="${app.dest.webinf}/tempweb.xml" />
85
86     <!--final web.xml location  -->
87     <property name="app.dest.web.xml"
88               location="${app.dest.webinf}/web.xml" />
89
90     <property name="app.war.file"
91               location="${dist.home}/${propval.app.war.name}.war" />
92
93     <!-- default web.xml -->
94     <property name="propval.app.web.xml"
95               value="war/WEB-INF/web.xml" />
96
97               <!--
98     <property name="app.web.xml"
99               location="${propval.app.web.xml}" />
100               -->
101     <resolveFile name="app.web.xml"
102                  file="${propval.app.web.xml}"
103                  base="${app.sou.dir}"/>
104
105     <property name="app.sou.properties"
106               location="${app.sou.dir}/war/WEB-INF/classes/servlet.properties" />
107   </target>
108
109   <target name="build" depends="init">
110     <echo message="**************************************************" />
111     <echo message=" * Building war ${propval.app.war.name}"/>
112     <echo message="**************************************************" />
113
114     <delete dir="${app.dest.war}" />
115
116     <!-- Add modifed login pages -->
117     <copy todir="${app.dest.docs}/login" failonerror="false" >
118       <fileset dir="${org.bedework.common.resources}/login" />
119       <filterset>
120         <filter token="DISPLAY-NAME" value="${propval.app.display.name}"/>
121       </filterset>
122     </copy>
123
124     <!-- ===============================================================
125          We copy 3 sets of properties.
126
127          First (for struts) are the servlet properties which ends up as
128               classes/servlet.properties
129          Next we copy in a set of generic property files and then with
130          overwrite we copy in a set of base specific files.
131
132          All are updated with new values.
133          =============================================================== -->
134
135     <if>
136       <available file="${app.sou.dir}/war/docs" type="dir" />
137       <then>
138         <copy todir="${app.dest.docs}">
139           <fileset dir="${app.sou.dir}/war/docs" />
140         </copy>
141       </then>
142     </if>
143
144     <!-- ===============================================================
145          Any property files we need for configuration, other than the
146          standard struts file, should be in the "${app.sou.dir}/properties
147          directory. They will be copied into the appropriate place for the
148          war and transformed by the above filter.
149          =============================================================== -->
150
151     <!-- Create the runtime options file -->
152     <mkdir dir="${app.dest.properties}" />
153
154     <if>
155       <available file="${app.sou.dir}/properties" type="dir" />
156       <then>
157         <copy todir="${app.dest.properties}" overwrite="yes" >
158           <fileset dir="${app.sou.dir}/properties"
159                    includes="*.properties"/>
160           <filterset refid="property.filters" />
161         </copy>
162       </then>
163     </if>
164
165     <copy tofile="${app.dest.properties}/options.xml"
166           file="${org.bedework.config.options}" >
167       <filterset>
168         <filter token="RPI-DEBUG" value="${app.debug.val}"/>
169       </filterset>
170       <filterset refid="property.filters" />
171     </copy>
172
173     <!-- Temp do it again -->
174     <mkdir dir="${app.dest.properties.old}" />
175
176     <copy tofile="${app.dest.properties.old}/options.xml"
177           file="${org.bedework.config.options}" >
178       <filterset>
179         <filter token="RPI-DEBUG" value="${app.debug.val}"/>
180       </filterset>
181       <filterset refid="property.filters" />
182     </copy>
183
184     <if>
185       <available file="${app.sou.dir}/war/WEB-INF/classes" type="dir" />
186       <then>
187                     <copy todir="${app.dest.classes}">
188                       <fileset dir="${app.sou.dir}/war/WEB-INF/classes"
189                                includes="*"/>
190                       <filterset refid="property.filters" />
191                     </copy>
192       </then>
193     </if>
194
195         <!-- Make our own servlet.properties file for struts applications
196     <copy tofile="${app.dest.classes}/servlet.properties" file="${app.sou.properties}">
197       <filterset refid="property.filters" />
198     </copy>
199     -->
200
201     <copy tofile="${app.dest.classes}/sysevents.properties"
202           file="${org.bedework.config.sysevents.properties}" />
203
204     <!-- ===============================================================
205          Add hibernate jars and property files from calendar api.
206          =============================================================== -->
207
208     <copy todir="${app.dest.classes}">
209       <fileset dir="${org.bedework.project.calendarapi}/calCore/resources/properties" />
210       <filterset refid="property.filters" />
211     </copy>
212
213     <copy todir="${app.dest.classes}">
214       <fileset dir="${org.bedework.project.calendarapi}/calCore/resources/hbms" />
215       <filterset refid="property.filters" />
216     </copy>
217
218     <!-- Make a temp copy of the web.xml file -->
219     <copy tofile="${app.temp.web.xml}" file="${app.web.xml}"
220           overwrite="yes" />
221
222     <antcall target="struts-stuff" inheritRefs="true" />
223
224     <!-- Filter the temp copy of the web.xml file -->
225     <copy tofile="${app.dest.web.xml}"
226           file="${app.temp.web.xml}"
227           overwrite="yes" >
228       <filterset>
229         <filter token="RPI-DEBUG" value="${app.debug.val}"/>
230       </filterset>
231       <filterset refid="property.filters" />
232     </copy>
233
234     <delete file="${app.temp.web.xml}" />
235
236     <!-- Add the context root to the file. Note that newline is required -->
237     <echo file="${org.bedework.global.context.roots}" append="yes">
238 ${propval.app.war.name}.context=${propval.app.context.root}
239     </echo>
240
241     <!-- Add libraries: Platform specific -->
242     <antcall target="addLibs" inheritRefs="true" />
243
244     <!-- Platform specific -->
245     <antcall target="doPlatform" inheritRefs="true" />
246
247     <!-- build the war file or directory -->
248     <mkdir dir="${dist.home}" />
249        
250         <!-- may be there as a file or a directory -->
251     <delete file="${app.war.file}" />
252     <delete dir="${app.war.file}" />
253        
254     <if>
255         <or>
256                 <not>
257           <isset property="org.bedework.global.wars.zipped" />
258                 </not>
259                 <istrue value="${org.bedework.global.wars.zipped}"/>
260       </or>
261       <then>
262         <!-- Build a zipped war file -->
263         <war warfile="${app.war.file}"
264              webxml="${app.dest.web.xml}"
265              basedir="${app.dest.war}"
266              excludes="WEB-INF/web.xml" />
267       </then>
268       <else>
269         <!-- Unzipped war file -->
270         <copy todir="${app.war.file}">
271           <fileset dir="${app.dest.war}"  includes="*"/>
272           <filterset refid="property.filters" />
273         </copy>
274       </else>
275     </if>
276   </target>
277
278   <!-- =================================================================
279        If this is a struts app the following gets executed.
280        We create an updated struts-config.xml file and add some jars.
281        ================================================================= -->
282
283   <target name="struts-stuff" if="org.bedework.strutsapp">
284         <!-- Make our own servlet.properties file for struts applications -->
285     <echo file="${app.dest.classes}/servlet.properties" ><![CDATA[#
286 # ========================================================================
287 # This file contains all properties for servlet applications.
288 # It cannot be application specific as the jboss build creates a
289 # single set of resources on the classpath.
290 # ========================================================================
291 #
292
293 # ========================================================================
294 # Properties for the xml/xslt based calendar web applications
295 # ========================================================================
296 #
297 # author Mike Douglass douglm rpi.edu
298
299 # This is only here because the jetspeed portal-struts bridge does not seem to be
300 # passing across the servlet context.
301 #org.bedework.svcicb.sessionAttrName=org.bedework.admin.svcicb.sessionattrname.@APP-NAME@
302
303 # These are required by the Struts framework
304 errors.header=<errors><ul>
305 errors.footer=</ul></errors>
306
307 messages.header=<messages><ul>
308 messages.footer=</ul></messages>
309
310 edu.rpi.sss.util.action.noactionerrors=yes
311
312 applicationResources=<li>Cannot load application resources bundle {0}</li>
313
314 # set the default content type - html for jsp, xml for xml/xslt.
315 #edu.rpi.sss.util.action.contenttype=@DEFAULT-CONTENTTYPE@
316 edu.rpi.sss.util.action.contenttype=text/xml
317
318 edu.rpi.sss.util.error.exc=<li>Exception: {0}</li>
319
320 # Turn nocache headers on. We don't use the standard struts directives
321 # because we need to be able to turn nocache off for a single response.
322 # This gets around an IE problem with delivery of files.
323 edu.rpi.sss.util.action.nocache=yes
324
325 org.bedework.security.prefix=@SECURITY-PREFIX@
326
327 edu.rpi.sss.util.action.logprefix=@APP-NAME@
328
329 # Roles we need to know about - init action uses these
330 # (Not using roles in the current system)
331 #org.bedework.role.admin=@SECURITY-PREFIX@.admin
332 #org.bedework.role.contentadmin=@SECURITY-PREFIX@.contentadmin
333 #org.bedework.role.alert=@SECURITY-PREFIX@.alerts
334 #org.bedework.role.owner=@SECURITY-PREFIX@.owner
335 ]]></echo>
336
337     <!-- Replace the tokens -->
338     <replace file="${app.dest.classes}/servlet.properties">
339       <replacefilter token="@SECURITY-PREFIX@"
340                      value="${propval.app.security.prefix}" />
341       <replacefilter token="@APP-NAME@"
342                      value="${propval.app.name}" />
343       <replacefilter token="@DEFAULT-CONTENTTYPE@"
344                      value="${propval.app.default.contenttype}" />
345     </replace>
346        
347     <!-- Copy a dummy startup file into the war. -->
348     <copy todir="${app.dest.war}">
349       <fileset dir="${app.sou.dir}/war/" includes="setup.do" />
350     </copy>
351
352     <copy todir="${app.dest.webinf}"
353           file="${app.sou.dir}/war/WEB-INF/struts-config.xml"/>
354
355     <mkdir  dir="${app.dest.webinf}/tlds"/>
356     <copy todir="${app.dest.webinf}/tlds" >
357       <fileset dir="${org.bedework.struts.tlds}">
358         <include name="*"/>
359       </fileset>
360     </copy>
361
362     <if>
363       <isset property="org.bedework.global.portal.platform" />
364       <then>
365         <antcall target="doPortal" inheritRefs="true" />
366       </then>
367     </if>
368
369   </target>
370 </project>
Note: See TracBrowser for help on using the browser.