root/trunk/build/buildwar.xml

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

Upgrade to lucene 2.0.0

Add limits to searches - ui changes still pending.

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