root/trunk/bedework/build/buildwar.xml

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

--

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         <include name="bw-appcommon*.jar"/>
309         <include name="bw-appcommon*.jar"/>
310         <include name="bw-appcommon*.jar"/>
311         <include name="bw-appcommon*.jar"/>
312       </fileset>
313     </copy>
314
315      <!-- any extra bin files-->
316     <copy todir="${app.dest.lib}" >
317       <fileset refid="app.bin.files" />
318     </copy>
319
320     <!-- Some more standard libs -->
321     <copy todir="${app.dest.lib}" file="${commons-codec.jar}"/>
322     <copy todir="${app.dest.lib}" file="${commons-collections.jar}"/>
323     <copy todir="${app.dest.lib}" file="${commons-ssl.jar}"/>
324
325
326     <!-- add the jdbcdriver if defined -->
327     <antcall target="add.jdbcdriver" inheritRefs="true" />
328
329     <!-- free busy -->
330     <antcall target="add.freebusy" inheritRefs="true" />
331
332      <!-- any extra lib files-->
333     <copy todir="${app.dest.lib}" >
334       <fileset refid="app.lib.files" />
335       <fileset refid="app.temp.lib.files" />
336     </copy>
337
338     <!-- build the war file -->
339     <mkdir dir="${dist.home}" />
340     <delete file="${app.war.file}" />
341
342     <war warfile="${app.war.file}"
343          webxml="${app.dest.web.xml}"
344          basedir="${app.dest.war}"
345          excludes="${app.dest.web.xml}" />
346
347     <!-- build the ear file for a j2ee app
348     <antcall target="build.ear" inheritRefs="true" />
349     -->
350   </target>
351
352   <target name="add.freebusy" if="org.bedework.war.build.freebusy">
353     <copy todir="${app.dest.lib}" file="${org.bedework.fbclient.jar}" />
354     <copy todir="${app.dest.lib}" file="${org.bedework.fbaggregator.jar}" />
355   </target>
356
357   <target name="add.jdbcdriver" if="app.jdbcdriver.jar">
358     <copy todir="${app.dest.lib}" file="${app.jdbcdriver.jar}"/>
359   </target>
360
361   <target name="copy.properties" if="org.bedework.properties.dir.exists">
362     <!-- ===============================================================
363          Any property files we need for configuration, other than the
364          standard struts file, should be in the "${app.sou.dir}/properties
365          directory. They will be copied into the appropriate place for the
366          war and transformed by the above filter.
367          =============================================================== -->
368     <copy todir="${app.dest.properties}" overwrite="yes" >
369       <fileset dir="${app.sou.dir}/properties"
370                includes="*.properties"/>
371       <filterset refid="property.filters" />
372     </copy>
373   </target>
374
375   <target name="copy.servlet.properties" if="org.bedework.servlet.properties.exists">
376     <copy tofile="${app.dest.classes}/servlet.properties" file="${app.sou.properties}">
377       <filterset refid="property.filters" />
378     </copy>
379   </target>
380
381   <target name="copy.war.docs" if="org.bedework.war.docs.exists">
382     <copy todir="${app.dest.docs}">
383       <fileset dir="${app.sou.dir}/war/docs" />
384     </copy>
385   </target>
386
387   <target name="bexchange-stuff" if="org.bedework.build.caldav.bexchange">
388     <copy tofile="${app.dest.properties}/timezones.xml"
389           file="${org.bedework.resources.base}/bwtimezones.xml" />
390   </target>
391
392   <target name="domino-stuff" if="org.bedework.build.caldav.domino">
393     <copy tofile="${app.dest.properties}/timezones.xml"
394           file="${org.bedework.resources.base}/bwtimezones.xml" />
395   </target>
396
397   <target name="google-stuff" if="org.bedework.build.caldav.google">
398     <copy todir="${app.dest.lib}">
399       <fileset dir="${google.dir}">
400         <include name="*.jar"/>
401       </fileset>
402     </copy>
403
404     <copy tofile="${app.dest.properties}/timezones.xml"
405           file="${org.bedework.resources.base}/bwtimezones.xml" />
406   </target>
407
408   <!-- =================================================================
409        If this is a struts app the following gets executed.
410        We create an updated struts-config.xml file and add some jars.
411        ================================================================= -->
412
413   <target name="struts-stuff" if="org.bedework.strutsapp">
414     <!-- Copy a dummy startup file into the war. -->
415     <copy todir="${app.dest.war}">
416       <fileset dir="${app.sou.dir}/war/" includes="setup.do" />
417     </copy>
418
419     <copy todir="${app.dest.webinf}"
420           file="${app.sou.dir}/war/WEB-INF/struts-config.xml"/>
421
422     <mkdir  dir="${app.dest.webinf}/tlds"/>
423     <copy todir="${app.dest.webinf}/tlds" >
424       <fileset dir="${struts.tlds.dir}">
425         <include name="*"/>
426       </fileset>
427     </copy>
428     <copy todir="${app.dest.webinf}/tlds" >
429       <fileset dir="${org.bedework.default.lib}/tlds">
430         <include name="*"/>
431       </fileset>
432     </copy>
433
434     <antcall target="add.xalan" inheritRefs="true" />
435     <antcall target="add.jetspeed2" inheritRefs="true" />
436     <antcall target="add.uportal2" inheritRefs="true" />
437
438     <copy todir="${app.dest.lib}">
439       <fileset dir="${struts.dir}">
440         <include name="*.jar"/>
441       </fileset>
442     </copy>
443
444     <copy todir="${app.dest.lib}" file="${antlr.jar}"/>
445     <copy todir="${app.dest.lib}" file="${commons-beanutils.jar}"/>
446     <copy todir="${app.dest.lib}" file="${digester.jar}"/>
447     <copy todir="${app.dest.lib}" file="${commons-fileupload.jar}"/>
448     <copy todir="${app.dest.lib}" file="${commons-logging.jar}"/>
449     <copy todir="${app.dest.lib}" file="${commons-validator.jar}"/>
450     <copy todir="${app.dest.lib}" file="${jakarta-oro.jar}"/>
451   </target>
452
453   <target name="add.jetspeed2" if="org.bedework.build.for.jetspeed2" >
454     <copy todir="${app.dest.webinf}"
455           file="${org.bedework.deploy.type.dir}/jetspeed2/${propval.app.war.name}/portlet.xml"
456           overwrite="yes"
457           failonerror="no" />
458     <copy todir="${app.dest.webinf}"
459           file="${org.bedework.deploy.type.dir}/jetspeed2/struts-portlet-config.xml"
460           overwrite="yes"
461           failonerror="no" />
462
463     <copy todir="${app.dest.lib}" >
464       <fileset dir="${org.bedework.default.lib}/${jetspeed2.jars.dir}/portals-bridges-struts">
465         <include name="*.jar"/>
466       </fileset>
467     </copy>
468
469     <copy todir="${app.dest.webinf}/tlds" >
470       <fileset dir="${org.bedework.default.lib}/${jetspeed2.jars.dir}/portals-bridges-struts">
471         <include name="*.tld"/>
472       </fileset>
473     </copy>
474
475     <!-- Add the portal bridge controller def -->
476     <replace file="${app.dest.webinf}/struts-config.xml">
477       <replacetoken><![CDATA[<!-- Jetspeed2 controller def here -->]]></replacetoken>
478       <replacevalue><![CDATA[<controller pagePattern="$M$P" inputForward="true"
479               processorClass="org.apache.portals.bridges.struts.PortletRequestProcessor"/>]]>
480       </replacevalue>
481     </replace>
482   </target>
483
484   <target name="add.uportal2" if="org.bedework.build.for.uportal2" >
485     <copy todir="${app.dest.webinf}"
486           file="${org.bedework.deploy.type.dir}/uportal2/portlet.xml"
487           overwrite="yes"
488           failonerror="no" >
489       <filterset refid="property.filters" />
490     </copy>
491
492     <copy todir="${app.dest.webinf}"
493           file="${org.bedework.deploy.type.dir}/uportal2/struts-portlet-config.xml"
494           overwrite="yes"
495           failonerror="no" />
496
497     <copy todir="${app.dest.lib}" >
498       <fileset dir="${portals-bridges.jars.dir}">
499         <include name="*.jar"/>
500       </fileset>
501       <fileset dir="${bin.home}">
502         <include name="bw-uportal*.jar"/>
503       </fileset>
504     </copy>
505
506     <copy todir="${app.dest.webinf}/tlds"
507           overwrite="yes"
508           failonerror="no" >
509       <fileset dir="${org.bedework.deploy.type.dir}/uportal2" >
510         <include name="*.tld"/>
511       </fileset>
512     </copy>
513
514     <copy todir="${app.dest.lib}" file="${org.bedework.uportal.jar}" />
515
516     <!-- Add the portlet servlet mapping -->
517     <replace file="${app.dest.webinf}/web.xml">
518       <replacetoken><![CDATA[<!-- uPortal2 portlet servlet mapping here -->]]></replacetoken>
519       <replacevalue><![CDATA[<servlet-mapping>
520     <servlet-name>@PORTLET-NAME@</servlet-name>
521     <url-pattern>/@PORTLET-NAME@/*</url-pattern>
522   </servlet-mapping>]]>
523       </replacevalue>
524     </replace>
525
526     <replace file="${app.dest.webinf}/web.xml">
527       <replacefilter token="@PORTLET-NAME@" value="${propval.app.portlet.name}"/>
528     </replace>
529
530     <!-- Add the portal bridge controller def -->
531     <replace file="${app.dest.webinf}/struts-config.xml">
532       <replacetoken><![CDATA[<!-- Jetspeed2 controller def here -->]]></replacetoken>
533       <replacevalue><![CDATA[<controller pagePattern="$M$P" inputForward="true"
534               processorClass="org.apache.portals.bridges.struts.PortletRequestProcessor"/>]]>
535       </replacevalue>
536     </replace>
537   </target>
538
539   <target name="add.xalan" unless="xalan.in.tomcat.common.endorsed" >
540     <copy todir="${app.dest.lib}" file="${xalan.jar}"/>
541   </target>
542
543   <!-- =================================================================
544        If this is a j2ee app the following gets executed.
545        We create an uodated jboss-web.xml file (for jboss) and a ear
546        ================================================================= -->
547
548   <target name="jboss-stuff" if="org.bedework.build.for.jboss">
549     <copy todir="${app.dest.webinf}"
550           file="${app.sou.dir}/war/WEB-INF/jboss-web.xml">
551       <filterset refid="property.filters" />
552     </copy>
553     <antcall target="jboss-virtual-host" inheritRefs="true" />
554   </target>
555
556   <target name="jboss-virtual-host" if="org.bedework.global.virtual.host">
557     <replace file="${app.dest.webinf}/jboss-web.xml">
558       <replacetoken><![CDATA[<!-- Virtual host -->]]></replacetoken>
559       <replacevalue><![CDATA[<virtual-host>@VIRTUAL-HOST@</virtual-host>
560       ]]>
561       </replacevalue>
562     </replace>
563     <replace file="${app.dest.webinf}/jboss-web.xml">
564       <replacefilter token="@VIRTUAL-HOST@" value="${org.bedework.global.virtual.host}"/>
565     </replace>
566   </target>
567
568   <target name="build.ear" if="cal.j2ee">
569     <ant antfile="${buildear}"
570          inheritRefs="true" target="build" />
571   </target>
572 </project>
Note: See TracBrowser for help on using the browser.