root/trunk/bedework/build/buildwar.xml

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

Moved web config classes into calfacade
Fixed up jboss build

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