root/trunk/build/buildwar.xml

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