root/trunk/bedework/build/buildwar.xml

Revision 953 (checked in by douglm, 7 years ago)

deploy of bedework now runs to completion

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     cal.j2ee           Defined if this is a j2ee application
22     cal.j2ee.jboss     Defined if this is a jboss application
23     cal.strutsapp      Defined if this is a struts application
24      These should be defined in the build properties for the application.
25
26      It is possible to define any of the app.dest properties below to override
27      the location of destination files.
28
29      In the directory
30         ${apps.sou.dir}
31      we expect an application skeleton formatted like a web-application
32      For the purposes of this build it should contain a
33      structure like
34               war - docs    (contains jsp and html for this app)
35                     WEB-INF - struts-config.xml
36                               web.xml
37                               jboss-web.xml (for jboss only)
38
39      Authors: Mike Douglass   douglm@rpi.edu
40      =================================================================== -->
41
42 <project name="bedework.buildwar" default="build" >
43   <target name="init" depends="init.common,init.uportal2,init.j2ee,init.standalone" />
44
45   <target name="init.common">
46     <!-- Load the location of the libraries -->
47     <property file="${org.bedework.project.bedework}/build/libjars.properties" />
48
49     <!--
50     <condition property="org.bedework.build.for.jetspeed2">
51       <equals arg1="jetspeed2" arg2="${propval.app.portal.platform}"/>
52     </condition>
53
54     <condition property="org.bedework.build.for.uportal2">
55       <equals arg1="uportal2" arg2="${propval.app.portal.platform}"/>
56     </condition>
57
58     <condition property="org.bedework.build.for.jboss">
59       <equals arg1="jboss" arg2="${org.bedework.global.j2ee.platform}"/>
60     </condition>
61     -->
62
63     <condition property="org.bedework.war.build.freebusy">
64       <equals arg1="yes" arg2="${org.bedework.build.freebusy}"/>
65     </condition>
66
67     <!-- Destinations - where we build an unwrapped war -->
68     <property name="app.dest.war"
69               location="${org.bedework.temp.wars.home}/${propval.app.war.name}.war" />
70     <property name="app.dest.docs"
71               location="${app.dest.war}/docs" />
72     <property name="app.dest.webinf"
73               location="${app.dest.war}/WEB-INF" />
74     <property name="app.dest.classes"
75               location="${app.dest.webinf}/classes" />
76     <property name="app.dest.properties"
77               location="${app.dest.classes}/properties/calendar" />
78
79     <!--temp web.xml location  -->
80     <property name="app.dest.web.xml"
81               location="${app.dest.webinf}/web.xml" />
82
83     <property name="app.war.file"
84               location="${dist.home}/${propval.app.war.name}.war" />
85
86     <!-- These may have been set already -->
87     <property name="app.web.xml"
88               value="${app.sou.dir}/war/WEB-INF/web.xml" />
89     <property name="app.sou.properties"
90               location="${app.sou.dir}/war/WEB-INF/classes/servlet.properties" />
91   </target>
92
93   <target name="init.uportal2" if="org.bedework.build.for.uportal2" >
94     <property name="propval.app.servlet.class"
95               value="org.apache.portals.bridges.struts.PortletServlet" />
96
97     <property name="propval.app.ignoreContentType"
98               value="true" />
99
100     <property name="propval.app.genurl.taglib.tld"
101               value="bedework-uportal2.tld" />
102   </target>
103
104   <target name="init.standalone" if="org.bedework.global.build.standalone.app">
105     <property name="propval.app.servlet.class"
106               value="org.apache.struts.action.ActionServlet" />
107
108     <property name="propval.app.ignoreContentType"
109               value="false" />
110
111     <property name="propval.app.portlet.mapping" value="" />
112
113     <property name="propval.app.genurl.taglib.tld"
114               value="struts-html.tld" />
115
116     <property name="app.dest.lib"
117               location="${app.dest.webinf}/lib" />
118   </target>
119
120   <target name="init.j2ee" if="org.bedework.global.j2ee.platform">
121     <property name="app.dest.lib"
122               location="${org.bedework.temp.home}/earlib" />
123   </target>
124
125   <target name="build" depends="init">
126     <delete dir="${app.dest.war}" />
127
128     <!-- Add modifed login pages -->
129     <copy todir="${app.dest.docs}/login" failonerror="false" >
130       <fileset dir="${app.root.dir}/resources/login" />
131       <filterset>
132         <filter token="DISPLAY-NAME" value="${propval.app.display.name}"/>
133       </filterset>
134     </copy>
135
136     <!-- ===============================================================
137          We copy 3 sets of properties.
138
139          First (for struts) are the servlet properties which ends up as
140               classes/servlet.properties
141          Next we copy in a set of generic property files and then with
142          overwrite we copy in a set of base specific files.
143
144          All are updated with new values.
145          =============================================================== -->
146
147     <filterset id="property.filters" >
148       <filter token="BW-APP-NAME"
149               value="${org.bedework.deploy.name}"/>
150
151       <filter token="HIBERNATE-DIALECT"
152               value="${org.bedework.global.hibernate.dialect}" />
153
154       <filter token="DIRECTORY-BROWSING-DISALLOWED"
155               value="${org.bedework.global.directory.browsing.disallowed}" />
156
157       <filter token="IGNORE-CONTENT-TYPE"
158               value="${propval.app.ignoreContentType}" />
159
160       <filter token="APP-DESCRIPTION"
161               value="${propval.app.description}" />
162
163       <filter token="PORTAL-PLATFORM"
164               value="${propval.app.portal.platform}"/>
165
166       <filter token="PORTLET-NAME"
167               value="${propval.app.portlet.name}"/>
168
169       <filter token="CAL-SUITE"
170               value="${propval.app.cal.suite}"/>
171
172       <filter token="SERVLET-CLASS"
173               value="${propval.app.servlet.class}"/>
174
175       <filter token="GENURL-TAGLIB-TLD"
176               value="${propval.app.genurl.taglib.tld}"/>
177
178       <filter token="SECURITY-DOMAIN"
179               value="${propval.app.security.domain}"/>
180       <filter token="SECURITY-PREFIX"
181               value="${propval.app.security.prefix}"/>
182       <filter token="TRANSPORT-GUARANTEE"
183               value="${propval.app.transport.guarantee}"/>
184
185       <filter token="DISPLAY-NAME"
186               value="${propval.app.display.name}"/>
187       <filter token="CONTEXT-ROOT"
188               value="${propval.app.context.root}" />
189       <filter token="APP-NAME"
190               value="${propval.app.name}"/>
191       <filter token="APP-VERSION"
192               value="${propval.app.version}"/>
193
194       <filter token="DEFAULT-CONTENTTYPE"
195               value="${propval.app.default.contenttype}" />
196       <filter token="NOXSLT"
197               value="${propval.app.noxslt}" />
198       <filter token="APPLICATION-ROOT"
199               value="${propval.app.root}" />
200
201       <filter token="APP-GUESTMODE"
202               value="${propval.app.guestmode}" />
203
204       <!-- Change this to be an app par -->
205       <filter token="RUN-AS-USER"
206               value="${org.bedework.syspar.public.user}" />
207
208               <!-- ???????
209       <filter token="CALFILE-NAME"
210               value="${propval.app.calfile.name}" /> -->
211       <filter token="ADMIN-URI"
212               value="${org.bedework.global.public.admin.uri}" />
213       <filter token="PUBEVENTS-URI"
214               value="${org.bedework.global.public.calendar.uri}" />
215       <filter token="PERSONAL-URI"
216               value="${org.bedework.global.personal.calendar.uri}" />
217     </filterset>
218
219     <available file="${app.sou.dir}/properties" type="dir"
220                property="org.bedework.properties.dir.exists" />
221
222     <available file="${app.sou.properties}" type="file"
223                property="org.bedework.servlet.properties.exists" />
224
225     <available file="${app.sou.dir}/war/docs" type="dir"
226                property="org.bedework.war.docs.exists" />
227
228     <antcall target="copy.properties" inheritRefs="true" />
229     <antcall target="copy.servlet.properties" inheritRefs="true" />
230     <antcall target="copy.war.docs" inheritRefs="true" />
231
232     <!-- Create the env.properties file -->
233     <mkdir dir="${app.dest.properties}" />
234
235     <copy tofile="${app.dest.properties}/env.properties"
236           file="${org.bedework.config.properties}" />
237
238     <copy tofile="${app.dest.properties}/options.xml"
239           file="${org.bedework.config.options}" >
240       <filterset>
241         <filter token="RPI-DEBUG" value="${app.debug.val}"/>
242       </filterset>
243       <filterset refid="property.filters" />
244     </copy>
245
246     <!-- Make a modified copy of the web.xml file -->
247     <copy tofile="${app.dest.web.xml}"
248           file="${app.web.xml}"
249           overwrite="yes" >
250       <filterset>
251         <filter token="RPI-DEBUG" value="${app.debug.val}"/>
252       </filterset>
253       <filterset refid="property.filters" />
254     </copy>
255
256     <antcall target="struts-stuff" inheritRefs="true" />
257
258     <!-- ===============================================================
259          Add hibernate jars and property files from calendar api.
260          =============================================================== -->
261
262     <copy todir="${app.dest.classes}">
263       <fileset dir="${org.bedework.project.calendarapi}/calCore/resources/properties" />
264       <filterset refid="property.filters" />
265     </copy>
266
267     <copy todir="${app.dest.classes}">
268       <fileset dir="${org.bedework.project.calendarapi}/calCore/resources/hbms" />
269       <filterset refid="property.filters" />
270     </copy>
271
272     <copy todir="${app.dest.lib}">
273       <fileset dir="${hibernate.jars.dir}">
274         <include name="*.jar"/>
275       </fileset>
276     </copy>
277
278     <antcall target="jboss-stuff" inheritRefs="true" />
279     <antcall target="bexchange-stuff" inheritRefs="true" />
280     <antcall target="domino-stuff" inheritRefs="true" />
281     <antcall target="google-stuff" inheritRefs="true" />
282
283     <!-- ===============================================================
284          Any jar files required
285          =============================================================== -->
286
287     <copy todir="${app.dest.lib}" overwrite="yes">
288       <fileset dir="${bin.home}">
289         <!-- jars from sub-projects needed by all -->
290         <include name="rpiaccess*.jar"/>
291         <include name="rpiutil*.jar"/>
292         <include name="bw-davdefs*.jar"/>
293         <include name="bw-davio*.jar"/>
294
295         <!-- Calendar api jars -->
296         <include name="bw-calcore*.jar"/>
297         <include name="bw-calcorei*.jar"/>
298         <include name="bw-calenv*.jar"/>
299         <include name="bw-calfacade*.jar"/>
300         <include name="bw-calsvc*.jar"/>
301         <include name="bw-calsvci*.jar"/>
302         <include name="bw-icalendar*.jar"/>
303         <include name="bw-locale*.jar"/>
304         <include name="bw-logging*.jar"/>
305
306         <!-- Common jars for web apps -->
307         <include name="bw-appcommon*.jar"/>
308       </fileset>
309     </copy>
310
311      <!-- any extra bin files-->
312     <copy todir="${app.dest.lib}" >
313       <fileset refid="app.bin.files" />
314     </copy>
315
316     <!-- Some more standard libs -->
317     <copy todir="${app.dest.lib}" file="${commons-codec.jar}"/>
318     <copy todir="${app.dest.lib}" file="${commons-collections.jar}"/>
319     <copy todir="${app.dest.lib}" file="${commons-ssl.jar}"/>
320
321
322     <!-- add the jdbcdriver if defined -->
323     <antcall target="add.jdbcdriver" inheritRefs="true" />
324
325     <!-- free busy -->
326     <antcall target="add.freebusy" inheritRefs="true" />
327
328      <!-- any extra lib files-->
329     <copy todir="${app.dest.lib}" >
330       <fileset refid="app.lib.files" />
331       <!-- <fileset refid="app.temp.lib.files" /> -->
332     </copy>
333
334     <!-- build the war file -->
335     <mkdir dir="${dist.home}" />
336     <delete file="${app.war.file}" />
337
338     <war warfile="${app.war.file}"
339          webxml="${app.dest.web.xml}"
340          basedir="${app.dest.war}"
341          excludes="${app.dest.web.xml}" />
342
343     <!-- build the ear file for a j2ee app
344     <antcall target="build.ear" inheritRefs="true" />
345     -->
346   </target>
347
348   <target name="add.freebusy" if="org.bedework.war.build.freebusy">
349     <copy todir="${app.dest.lib}" file="${org.bedework.fbclient.jar}" />
350     <copy todir="${app.dest.lib}" file="${org.bedework.fbaggregator.jar}" />
351   </target>
352
353   <target name="add.jdbcdriver" if="app.jdbcdriver.jar">
354     <copy todir="${app.dest.lib}" file="${app.jdbcdriver.jar}"/>
355   </target>
356
357   <target name="copy.properties" if="org.bedework.properties.dir.exists">
358     <!-- ===============================================================
359          Any property files we need for configuration, other than the
360          standard struts file, should be in the "${app.sou.dir}/properties
361          directory. They will be copied into the appropriate place for the
362          war and transformed by the above filter.
363          =============================================================== -->
364     <copy todir="${app.dest.properties}" overwrite="yes" >
365       <fileset dir="${app.sou.dir}/properties"
366                includes="*.properties"/>
367       <filterset refid="property.filters" />
368     </copy>
369   </target>
370
371   <target name="copy.servlet.properties" if="org.bedework.servlet.properties.exists">
372     <copy tofile="${app.dest.classes}/servlet.properties" file="${app.sou.properties}">
373       <filterset refid="property.filters" />
374     </copy>
375   </target>
376
377   <target name="copy.war.docs" if="org.bedework.war.docs.exists">
378     <copy todir="${app.dest.docs}">
379       <fileset dir="${app.sou.dir}/war/docs" />
380     </copy>
381   </target>
382
383   <target name="bexchange-stuff" if="org.bedework.build.caldav.bexchange">
384     <copy tofile="${app.dest.properties}/timezones.xml"
385           file="${org.bedework.resources.base}/bwtimezones.xml" />
386   </target>
387
388   <target name="domino-stuff" if="org.bedework.build.caldav.domino">
389     <copy tofile="${app.dest.properties}/timezones.xml"
390           file="${org.bedework.resources.base}/bwtimezones.xml" />
391   </target>
392
393   <target name="google-stuff" if="org.bedework.build.caldav.google">
394     <copy todir="${app.dest.lib}">
395       <fileset dir="${google.dir}">
396         <include name="*.jar"/>
397       </fileset>
398     </copy>
399
400     <copy tofile="${app.dest.properties}/timezones.xml"
401           file="${org.bedework.resources.base}/bwtimezones.xml" />
402   </target>
403
404   <!-- =================================================================
405        If this is a struts app the following gets executed.
406        We create an updated struts-config.xml file and add some jars.
407        ================================================================= -->
408
409   <target name="struts-stuff" if="org.bedework.strutsapp">
410     <!-- Copy a dummy startup file into the war. -->
411     <copy todir="${app.dest.war}">
412       <fileset dir="${app.sou.dir}/war/" includes="setup.do" />
413     </copy>
414
415     <copy todir="${app.dest.webinf}"
416           file="${app.sou.dir}/war/WEB-INF/struts-config.xml"/>
417
418     <mkdir  dir="${app.dest.webinf}/tlds"/>
419     <copy todir="${app.dest.webinf}/tlds" >
420       <fileset dir="${struts.tlds.dir}">
421         <include name="*"/>
422       </fileset>
423     </copy>
424     <copy todir="${app.dest.webinf}/tlds" >
425       <fileset dir="${org.bedework.default.lib}/tlds">
426         <include name="*"/>
427       </fileset>
428     </copy>
429
430     <antcall target="add.xalan" inheritRefs="true" />
431     <antcall target="add.jetspeed2" inheritRefs="true" />
432     <antcall target="add.uportal2" inheritRefs="true" />
433
434     <copy todir="${app.dest.lib}">
435       <fileset dir="${struts.dir}">
436         <include name="*.jar"/>
437       </fileset>
438     </copy>
439
440     <copy todir="${app.dest.lib}" file="${antlr.jar}"/>
441     <copy todir="${app.dest.lib}" file="${commons-beanutils.jar}"/>
442     <copy todir="${app.dest.lib}" file="${digester.jar}"/>
443     <copy todir="${app.dest.lib}" file="${commons-fileupload.jar}"/>
444     <copy todir="${app.dest.lib}" file="${commons-logging.jar}"/>
445     <copy todir="${app.dest.lib}" file="${commons-validator.jar}"/>
446     <copy todir="${app.dest.lib}" file="${jakarta-oro.jar}"/>
447   </target>
448
449   <target name="add.jetspeed2" if="org.bedework.build.for.jetspeed2" >
450     <copy todir="${app.dest.webinf}"
451           file="${org.bedework.deploy.type.dir}/jetspeed2/${propval.app.war.name}/portlet.xml"
452           overwrite="yes"
453           failonerror="no" />
454     <copy todir="${app.dest.webinf}"
455           file="${org.bedework.deploy.type.dir}/jetspeed2/struts-portlet-config.xml"
456           overwrite="yes"
457           failonerror="no" />
458
459     <copy todir="${app.dest.lib}" >
460       <fileset dir="${org.bedework.default.lib}/${jetspeed2.jars.dir}/portals-bridges-struts">
461         <include name="*.jar"/>
462       </fileset>
463     </copy>
464
465     <copy todir="${app.dest.webinf}/tlds" >
466       <fileset dir="${org.bedework.default.lib}/${jetspeed2.jars.dir}/portals-bridges-struts">
467         <include name="*.tld"/>
468       </fileset>
469     </copy>
470
471     <!-- Add the portal bridge controller def -->
472     <replace file="${app.dest.webinf}/struts-config.xml">
473       <replacetoken><![CDATA[<!-- Jetspeed2 controller def here -->]]></replacetoken>
474       <replacevalue><![CDATA[<controller pagePattern="$M$P" inputForward="true"
475               processorClass="org.apache.portals.bridges.struts.PortletRequestProcessor"/>]]>
476       </replacevalue>
477     </replace>
478   </target>
479
480   <target name="add.uportal2" if="org.bedework.build.for.uportal2" >
481     <copy todir="${app.dest.webinf}"
482           file="${org.bedework.deploy.type.dir}/uportal2/portlet.xml"
483           overwrite="yes"
484           failonerror="no" >
485       <filterset refid="property.filters" />
486     </copy>
487
488     <copy todir="${app.dest.webinf}"
489           file="${org.bedework.deploy.type.dir}/uportal2/struts-portlet-config.xml"
490           overwrite="yes"
491           failonerror="no" />
492
493     <copy todir="${app.dest.lib}" >
494       <fileset dir="${portals-bridges.jars.dir}">
495         <include name="*.jar"/>
496       </fileset>
497       <fileset dir="${bin.home}">
498         <include name="bw-uportal*.jar"/>
499       </fileset>
500     </copy>
501
502     <copy todir="${app.dest.webinf}/tlds"
503           overwrite="yes"
504           failonerror="no" >
505       <fileset dir="${org.bedework.deploy.type.dir}/uportal2" >
506         <include name="*.tld"/>
507       </fileset>
508     </copy>
509
510     <copy todir="${app.dest.lib}" file="${org.bedework.uportal.jar}" />
511
512     <!-- Add the portlet servlet mapping -->
513     <replace file="${app.dest.webinf}/web.xml">
514       <replacetoken><![CDATA[<!-- uPortal2 portlet servlet mapping here -->]]></replacetoken>
515       <replacevalue><![CDATA[<servlet-mapping>
516     <servlet-name>@PORTLET-NAME@</servlet-name>
517     <url-pattern>/@PORTLET-NAME@/*</url-pattern>
518   </servlet-mapping>]]>
519       </replacevalue>
520     </replace>
521
522     <replace file="${app.dest.webinf}/web.xml">
523       <replacefilter token="@PORTLET-NAME@" value="${propval.app.portlet.name}"/>
524     </replace>
525
526     <!-- Add the portal bridge controller def -->
527     <replace file="${app.dest.webinf}/struts-config.xml">
528       <replacetoken><![CDATA[<!-- Jetspeed2 controller def here -->]]></replacetoken>
529       <replacevalue><![CDATA[<controller pagePattern="$M$P" inputForward="true"
530               processorClass="org.apache.portals.bridges.struts.PortletRequestProcessor"/>]]>
531       </replacevalue>
532     </replace>
533   </target>
534
535   <target name="add.xalan" unless="xalan.in.tomcat.common.endorsed" >
536     <copy todir="${app.dest.lib}" file="${xalan.jar}"/>
537   </target>
538
539   <!-- =================================================================
540        If this is a j2ee app the following gets executed.
541        We create an uodated jboss-web.xml file (for jboss) and a ear
542        ================================================================= -->
543
544   <target name="jboss-stuff" if="org.bedework.build.for.jboss">
545     <copy todir="${app.dest.webinf}"
546           file="${app.sou.dir}/war/WEB-INF/jboss-web.xml">
547       <filterset refid="property.filters" />
548     </copy>
549     <antcall target="jboss-virtual-host" inheritRefs="true" />
550   </target>
551
552   <target name="jboss-virtual-host" if="org.bedework.global.virtual.host">
553     <replace file="${app.dest.webinf}/jboss-web.xml">
554       <replacetoken><![CDATA[<!-- Virtual host -->]]></replacetoken>
555       <replacevalue><![CDATA[<virtual-host>@VIRTUAL-HOST@</virtual-host>
556       ]]>
557       </replacevalue>
558     </replace>
559     <replace file="${app.dest.webinf}/jboss-web.xml">
560       <replacefilter token="@VIRTUAL-HOST@" value="${org.bedework.global.virtual.host}"/>
561     </replace>
562   </target>
563
564   <target name="build.ear" if="cal.j2ee">
565     <ant antfile="${buildear}"
566          inheritRefs="true" target="build" />
567   </target>
568 </project>
Note: See TracBrowser for help on using the browser.