root/trunk/build/buildwar.xml

Revision 1105 (checked in by douglm, 6 years ago)

To build bedework after this update will require ant-contrib.jar to be added to apache-ant-1.6.5/lib
This will be done in the preview quickstart

Upgraded portlet support. Managed to display the user calendar in liferay4.
Made much more of the portlet support common. Moved many config settings into the properties file.
Some changes still needed

Moved portlet stylesheets into common portlet directory

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.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     <!-- Destinations - where we build an unwrapped war -->
50     <property name="app.dest.war"
51               location="${org.bedework.temp.wars.home}/${propval.app.war.name}.war" />
52     <property name="app.dest.docs"
53               location="${app.dest.war}/docs" />
54     <property name="app.dest.webinf"
55               location="${app.dest.war}/WEB-INF" />
56     <property name="app.dest.metainf"
57               location="${app.dest.war}/META-INF" />
58     <property name="app.dest.classes"
59               location="${app.dest.webinf}/classes" />
60     <property name="app.dest.properties"
61               location="${app.dest.classes}/properties/calendar" />
62
63     <!--temp web.xml location  -->
64     <property name="app.dest.web.xml"
65               location="${app.dest.webinf}/web.xml" />
66
67     <property name="app.war.file"
68               location="${dist.home}/${propval.app.war.name}.war" />
69
70     <!-- default web.xml -->
71     <property name="propval.app.web.xml"
72               value="war/WEB-INF/web.xml" />
73
74               <!--
75     <property name="app.web.xml"
76               location="${propval.app.web.xml}" />
77               -->
78     <resolveFile name="app.web.xml"
79                  file="${propval.app.web.xml}"
80                  base="${app.sou.dir}"/>
81
82     <property name="app.sou.properties"
83               location="${app.sou.dir}/war/WEB-INF/classes/servlet.properties" />
84   </target>
85
86   <target name="init.standalone" if="org.bedework.global.build.standalone.app">
87
88     <property name="app.dest.lib"
89               location="${app.dest.webinf}/lib" />
90   </target>
91
92   <target name="init.j2ee" if="org.bedework.global.j2ee.platform">
93     <property name="app.dest.lib"
94               location="${org.bedework.temp.dir}/earlib" />
95   </target>
96
97   <target name="build" depends="init">
98     <delete dir="${app.dest.war}" />
99
100     <!-- Add modifed login pages -->
101     <copy todir="${app.dest.docs}/login" failonerror="false" >
102       <fileset dir="${app.root.dir}/resources/login" />
103       <filterset>
104         <filter token="DISPLAY-NAME" value="${propval.app.display.name}"/>
105       </filterset>
106     </copy>
107
108     <!-- ===============================================================
109          We copy 3 sets of properties.
110
111          First (for struts) are the servlet properties which ends up as
112               classes/servlet.properties
113          Next we copy in a set of generic property files and then with
114          overwrite we copy in a set of base specific files.
115
116          All are updated with new values.
117          =============================================================== -->
118
119     <filterset id="property.filters" >
120       <!--      Global settings            -->
121       <filter token="BW-APP-NAME"
122               value="${org.bedework.deploy.name}"/>
123
124       <filter token="HIBERNATE-DIALECT"
125               value="${org.bedework.global.hibernate.dialect}" />
126
127       <filter token="DIRECTORY-BROWSING-DISALLOWED"
128               value="${org.bedework.global.directory.browsing.disallowed}" />
129
130       <filter token="PORTAL-PLATFORM"
131               value="${org.bedework.global.portal.platform}"/>
132
133       <filter token="SERVLET-CLASS"
134               value="${org.bedework.global.servlet.class}"/>
135
136       <filter token="PORTLET-SERVLET-CLASS"
137               value="${org.bedework.global.portlet-servlet.class}"/>
138
139       <filter token="PORTAL-SERVLET-CONTEXT-PROVIDER"
140               value="${org.bedework.global.portal-servlet.context.provider}"/>
141
142       <filter token="PORTLET-CLASS"
143               value="${org.bedework.global.portlet.class}"/>
144
145       <filter token="IGNORE-CONTENT-TYPE"
146               value="${org.bedework.global.ignoreContentType}" />
147
148       <filter token="GENURL-TAGLIB-TLD"
149               value="${org.bedework.global.genurl.taglib.tld}"/>
150
151       <filter token="LIFERAY-COMPANY-ID"
152               value="${org.bedework.global.liferay.company-id}"/>
153
154       <!--      Application settings            -->
155
156       <filter token="APP-DESCRIPTION"
157               value="${propval.app.description}" />
158
159       <filter token="PORTLET-NAME"
160               value="${propval.app.portlet.name}"/>
161
162       <filter token="CAL-SUITE"
163               value="${propval.app.cal.suite}"/>
164
165       <filter token="SECURITY-DOMAIN"
166               value="${propval.app.security.domain}"/>
167       <filter token="SECURITY-PREFIX"
168               value="${propval.app.security.prefix}"/>
169       <filter token="TRANSPORT-GUARANTEE"
170               value="${propval.app.transport.guarantee}"/>
171
172       <filter token="DISPLAY-NAME"
173               value="${propval.app.display.name}"/>
174       <filter token="CONTEXT-ROOT"
175               value="${propval.app.context.root}" />
176       <filter token="APP-NAME"
177               value="${propval.app.name}"/>
178       <filter token="APP-VERSION"
179               value="${propval.app.version}"/>
180       <filter token="WAR-NAME"
181               value="${propval.app.war.name}"/>
182       <filter token="TOMCAT-DOC-BASE"
183               value="${org.bedework.appserver.dir}${propval.app.deploy.dir}/${propval.app.war.name}"/>
184
185       <filter token="DEFAULT-CONTENTTYPE"
186               value="${propval.app.default.contenttype}" />
187       <filter token="NOXSLT"
188               value="${propval.app.noxslt}" />
189       <filter token="APPLICATION-ROOT"
190               value="${propval.app.root}" />
191
192       <filter token="APP-GUESTMODE"
193               value="${propval.app.guestmode}" />
194
195       <!-- Change this to be an app par -->
196       <filter token="RUN-AS-USER"
197               value="${org.bedework.syspar.public.user}" />
198
199               <!-- ???????
200       <filter token="CALFILE-NAME"
201               value="${propval.app.calfile.name}" /> -->
202       <filter token="ADMIN-URI"
203               value="${org.bedework.global.public.admin.uri}" />
204       <filter token="PUBEVENTS-URI"
205               value="${org.bedework.global.public.calendar.uri}" />
206       <filter token="PERSONAL-URI"
207               value="${org.bedework.global.personal.calendar.uri}" />
208     </filterset>
209
210     <available file="${app.sou.dir}/properties" type="dir"
211                property="org.bedework.properties.dir.exists" />
212
213     <available file="${app.sou.properties}" type="file"
214                property="org.bedework.servlet.properties.exists" />
215
216     <available file="${app.sou.dir}/war/docs" type="dir"
217                property="org.bedework.war.docs.exists" />
218
219     <antcall target="copy.properties" inheritRefs="true" />
220     <antcall target="copy.servlet.properties" inheritRefs="true" />
221     <antcall target="copy.war.docs" inheritRefs="true" />
222
223     <!-- Create the env.properties file -->
224     <mkdir dir="${app.dest.properties}" />
225
226     <copy tofile="${app.dest.properties}/env.properties"
227           file="${org.bedework.config.properties}" />
228
229     <copy tofile="${app.dest.properties}/options.xml"
230           file="${org.bedework.config.options}" >
231       <filterset>
232         <filter token="RPI-DEBUG" value="${app.debug.val}"/>
233       </filterset>
234       <filterset refid="property.filters" />
235     </copy>
236
237     <!-- Make a modified copy of the web.xml file -->
238     <copy tofile="${app.dest.web.xml}"
239           file="${app.web.xml}"
240           overwrite="yes" >
241       <filterset>
242         <filter token="RPI-DEBUG" value="${app.debug.val}"/>
243       </filterset>
244       <filterset refid="property.filters" />
245     </copy>
246
247     <antcall target="struts-stuff" inheritRefs="true" />
248
249     <!-- ===============================================================
250          Add hibernate jars and property files from calendar api.
251          =============================================================== -->
252
253     <copy todir="${app.dest.classes}">
254       <fileset dir="${org.bedework.project.calendarapi}/calCore/resources/properties" />
255       <filterset refid="property.filters" />
256     </copy>
257
258     <copy todir="${app.dest.classes}">
259       <fileset dir="${org.bedework.project.calendarapi}/calCore/resources/hbms" />
260       <filterset refid="property.filters" />
261     </copy>
262
263     <copy todir="${app.dest.lib}">
264       <fileset dir="${hibernate.jars.dir}">
265         <include name="*.jar"/>
266       </fileset>
267     </copy>
268
269     <antcall target="jboss-stuff" inheritRefs="true" />
270     <antcall target="bexchange-stuff" inheritRefs="true" />
271     <antcall target="domino-stuff" inheritRefs="true" />
272     <antcall target="google-stuff" inheritRefs="true" />
273
274     <!-- ===============================================================
275          Any jar files required
276          =============================================================== -->
277
278     <copy todir="${app.dest.lib}" overwrite="yes">
279       <fileset dir="${bin.home}">
280         <!-- jars from sub-projects needed by all -->
281         <include name="rpiaccess*.jar"/>
282         <include name="rpiutil*.jar"/>
283         <include name="bw-davdefs*.jar"/>
284         <include name="bw-davio*.jar"/>
285
286         <!-- Calendar api jars -->
287         <include name="bw-apiutil*.jar"/>
288         <include name="bw-calcore*.jar"/>
289         <include name="bw-calcorei*.jar"/>
290         <include name="bw-calenv*.jar"/>
291         <include name="bw-calfacade*.jar"/>
292         <include name="bw-calsvc*.jar"/>
293         <include name="bw-calsvci*.jar"/>
294         <include name="bw-icalendar*.jar"/>
295         <include name="bw-locale*.jar"/>
296         <include name="bw-logging*.jar"/>
297
298         <!-- Common jars for web apps -->
299         <include name="bw-appcommon*.jar"/>
300       </fileset>
301     </copy>
302
303      <!-- any extra bin files-->
304     <copy todir="${app.dest.lib}" >
305       <fileset refid="app.bin.files" />
306     </copy>
307
308     <!-- Some more standard libs -->
309     <if>
310       <not>
311         <isset property="org.bedework.build.for.jboss"/>
312       </not>
313       <then>
314         <copy todir="${app.dest.lib}" file="${log4j.jar}"/>
315       </then>
316     </if>
317     <copy todir="${app.dest.lib}" file="${lucene.core.jar}"/>
318     <copy todir="${app.dest.lib}" file="${lucene.misc.jar}"/>
319     <copy todir="${app.dest.lib}" file="${ical4j.jar}"/>
320     <copy todir="${app.dest.lib}" file="${commons-codec.jar}"/>
321     <copy todir="${app.dest.lib}" file="${commons-collections.jar}"/>
322     <copy todir="${app.dest.lib}" file="${commons-httpclient.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     <!-- tomcat -->
330     <antcall target="add.tomcat" 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="WEB-INF/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.jdbcdriver" if="app.jdbcdriver.jar">
353     <copy todir="${app.dest.lib}" file="${app.jdbcdriver.jar}"/>
354   </target>
355
356   <target name="add.tomcat" if="org.bedework.global.deploy.on.tomcat">
357     <property name="propval.app.tomcat.context.xml"
358               location="${app.sou.dir}/war/META-INF/context.xml" />
359     <resolveFile name="app.tomcat.context.xml"
360                  file="${propval.app.tomcat.context.xml}"
361                  base="${app.sou.dir}"/>
362
363     <copy tofile="${app.dest.metainf}/context.xml"
364           file="${app.tomcat.context.xml}"
365           overwrite="yes" >
366       <filterset refid="property.filters" />
367     </copy>
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.project.bedework}/docs/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.project.bedework}/docs/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.project.bedework}/docs/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     <if>
444       <not>
445         <isset property="xalan.in.tomcat.common.endorsed" />
446       </not>
447       <then>
448         <copy todir="${app.dest.lib}" file="${xalan.jar}"/>
449       </then>
450     </if>
451
452     <if>
453       <isset property="org.bedework.global.portal.platform" />
454       <then>
455         <!-- Add common portlet files -->
456
457         <copy todir="${app.dest.lib}" >
458           <fileset dir="${portals-bridges.jars.dir}">
459             <include name="*.jar"/>
460           </fileset>
461         </copy>
462
463         <!-- Use generic bedework portlet tld -->
464         <copy todir="${app.dest.webinf}/tlds"
465               overwrite="yes"
466               failonerror="no" >
467           <fileset dir="${app.root.dir}/resources/portlet" >
468             <include name="*.tld"/>
469           </fileset>
470         </copy>
471
472         <copy todir="${app.dest.webinf}"
473               file="${org.bedework.deploy.type.dir}/portlet/struts-portlet-config.xml"
474               overwrite="yes"
475               failonerror="no" />
476
477         <copy todir="${app.dest.webinf}"
478               file="${org.bedework.deploy.type.dir}/portlet/portlet.xml"
479               overwrite="yes"
480               failonerror="no" >
481           <filterset refid="property.filters" />
482         </copy>
483
484         <!-- Add the portal bridge controller def -->
485         <replace file="${app.dest.webinf}/struts-config.xml">
486           <replacetoken><![CDATA[<!-- portlet 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
492         <replace file="${app.dest.webinf}/web.xml">
493           <replacefilter token="@PORTLET-NAME@" value="${propval.app.portlet.name}"/>
494         </replace>
495       </then>
496     </if>
497     <antcall target="add.jetspeed2" inheritRefs="true" />
498     <antcall target="add.uportal2" inheritRefs="true" />
499     <antcall target="add.liferay4" inheritRefs="true" />
500
501     <copy todir="${app.dest.lib}">
502       <fileset dir="${struts.dir}">
503         <include name="*.jar"/>
504       </fileset>
505     </copy>
506
507     <copy todir="${app.dest.lib}" file="${antlr.jar}"/>
508     <copy todir="${app.dest.lib}" file="${commons-beanutils.jar}"/>
509     <copy todir="${app.dest.lib}" file="${digester.jar}"/>
510     <copy todir="${app.dest.lib}" file="${commons-fileupload.jar}"/>
511     <copy todir="${app.dest.lib}" file="${commons-logging.jar}"/>
512     <copy todir="${app.dest.lib}" file="${commons-validator.jar}"/>
513     <copy todir="${app.dest.lib}" file="${jakarta-oro.jar}"/>
514   </target>
515
516   <target name="add.jetspeed2" if="org.bedework.build.for.jetspeed2" >
517     <copy todir="${app.dest.webinf}/tlds" >
518       <fileset dir="${org.bedework.default.lib}/${jetspeed2.jars.dir}/portals-bridges-struts">
519         <include name="*.tld"/>
520       </fileset>
521     </copy>
522   </target>
523
524   <target name="add.uportal2" if="org.bedework.build.for.uportal2" >
525     <copy todir="${app.dest.lib}" >
526       <fileset dir="${bin.home}">
527         <include name="bw-uportal*.jar"/>
528       </fileset>
529     </copy>
530
531     <!-- Add the portlet servlet mapping -->
532     <replace file="${app.dest.webinf}/web.xml">
533       <replacetoken><![CDATA[<!-- uPortal2 portlet servlet mapping here -->]]></replacetoken>
534       <replacevalue><![CDATA[<servlet-mapping>
535     <servlet-name>@PORTLET-NAME@</servlet-name>
536     <url-pattern>/@PORTLET-NAME@/*</url-pattern>
537   </servlet-mapping>]]>
538       </replacevalue>
539     </replace>
540
541   </target>
542
543   <target name="add.liferay4" if="org.bedework.build.for.liferay4" >
544    <!-- Add liferay config files -->
545     <copy todir="${app.dest.webinf}" >
546       <fileset dir="${app.sou.dir}/war/WEB-INF" >
547         <include name="liferay*"/>
548       </fileset>
549       <filterset refid="property.filters" />
550     </copy>
551
552     <copy todir="${app.dest.lib}" >
553       <fileset dir="${bin.home}">
554         <include name="bw-liferay*.jar"/>
555       </fileset>
556     </copy>
557
558     <!-- Add the portlet servlet mapping -->
559     <replace file="${app.dest.webinf}/web.xml">
560       <replacetoken><![CDATA[<!-- liferay4 portlet servlet mapping here -->]]></replacetoken>
561       <replacevalue><![CDATA[<listener>
562     <listener-class>
563       com.liferay.portal.servlet.PortletContextListener
564     </listener-class>
565   </listener>
566   <servlet-mapping>
567     <servlet-name>@PORTLET-NAME@</servlet-name>
568     <url-pattern>/@PORTLET-NAME@/*</url-pattern>
569   </servlet-mapping>]]>
570       </replacevalue>
571     </replace>
572   </target>
573
574   <!-- =================================================================
575        If this is a j2ee app the following gets executed.
576        We create an uodated jboss-web.xml file (for jboss) and a ear
577        ================================================================= -->
578
579   <target name="jboss-stuff" if="org.bedework.build.for.jboss">
580     <copy todir="${app.dest.webinf}"
581           file="${app.sou.dir}/war/WEB-INF/jboss-web.xml">
582       <filterset refid="property.filters" />
583     </copy>
584     <antcall target="jboss-virtual-host" inheritRefs="true" />
585   </target>
586
587   <target name="jboss-virtual-host" if="org.bedework.global.virtual.host">
588     <replace file="${app.dest.webinf}/jboss-web.xml">
589       <replacetoken><![CDATA[<!-- Virtual host -->]]></replacetoken>
590       <replacevalue><![CDATA[<virtual-host>@VIRTUAL-HOST@</virtual-host>
591       ]]>
592       </replacevalue>
593     </replace>
594     <replace file="${app.dest.webinf}/jboss-web.xml">
595       <replacefilter token="@VIRTUAL-HOST@" value="${org.bedework.global.virtual.host}"/>
596     </replace>
597   </target>
598
599   <target name="build.ear" if="cal.j2ee">
600     <ant antfile="${buildear}"
601          inheritRefs="true" target="build" />
602   </target>
603 </project>
Note: See TracBrowser for help on using the browser.