root/releases/bedework-3.3/build/buildwar.xml

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

Changes to get liferay build working (better)

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
40      =================================================================== -->
41
42 <project name="bedework.buildwar" default="build" >
43   <import file="${build.dir}/buildfilters.xml" />
44
45   <target name="init" depends="init.common,init.j2ee,init.standalone" />
46
47   <target name="init.common">
48     <!-- Load the location of the libraries -->
49     <property file="${org.bedework.project.bedework}/build/libjars.properties" />
50
51     <!-- Destinations - where we build an unwrapped war -->
52     <property name="app.dest.war"
53               location="${org.bedework.temp.wars.home}/${propval.app.war.name}.war" />
54     <property name="app.dest.docs"
55               location="${app.dest.war}/docs" />
56     <property name="app.dest.webinf"
57               location="${app.dest.war}/WEB-INF" />
58     <property name="app.dest.metainf"
59               location="${app.dest.war}/META-INF" />
60     <property name="app.dest.classes"
61               location="${app.dest.webinf}/classes" />
62     <property name="app.dest.properties"
63               location="${app.dest.classes}/properties/calendar" />
64
65     <!--temp web.xml location  -->
66     <property name="app.dest.web.xml"
67               location="${app.dest.webinf}/web.xml" />
68
69     <property name="app.war.file"
70               location="${dist.home}/${propval.app.war.name}.war" />
71
72     <!-- default web.xml -->
73     <property name="propval.app.web.xml"
74               value="war/WEB-INF/web.xml" />
75
76               <!--
77     <property name="app.web.xml"
78               location="${propval.app.web.xml}" />
79               -->
80     <resolveFile name="app.web.xml"
81                  file="${propval.app.web.xml}"
82                  base="${app.sou.dir}"/>
83
84     <property name="app.sou.properties"
85               location="${app.sou.dir}/war/WEB-INF/classes/servlet.properties" />
86   </target>
87
88   <target name="init.standalone" if="org.bedework.global.build.standalone.app">
89
90     <property name="app.dest.lib"
91               location="${app.dest.webinf}/lib" />
92   </target>
93
94   <target name="init.j2ee" if="org.bedework.global.j2ee.platform">
95     <property name="app.dest.lib"
96               location="${org.bedework.temp.dir}/earlib" />
97   </target>
98
99   <target name="build" depends="init">
100     <delete dir="${app.dest.war}" />
101
102     <!-- Add modifed login pages -->
103     <copy todir="${app.dest.docs}/login" failonerror="false" >
104       <fileset dir="${org.bedework.common.resources}/login" />
105       <filterset>
106         <filter token="DISPLAY-NAME" value="${propval.app.display.name}"/>
107       </filterset>
108     </copy>
109
110     <!-- ===============================================================
111          We copy 3 sets of properties.
112
113          First (for struts) are the servlet properties which ends up as
114               classes/servlet.properties
115          Next we copy in a set of generic property files and then with
116          overwrite we copy in a set of base specific files.
117
118          All are updated with new values.
119          =============================================================== -->
120
121     <available file="${app.sou.dir}/properties" type="dir"
122                property="org.bedework.properties.dir.exists" />
123
124     <available file="${app.sou.properties}" type="file"
125                property="org.bedework.servlet.properties.exists" />
126
127     <available file="${app.sou.dir}/war/docs" type="dir"
128                property="org.bedework.war.docs.exists" />
129
130     <antcall target="copy.properties" inheritRefs="true" />
131     <antcall target="copy.servlet.properties" inheritRefs="true" />
132     <antcall target="copy.war.docs" inheritRefs="true" />
133
134     <!-- Create the env.properties file -->
135     <mkdir dir="${app.dest.properties}" />
136
137     <copy tofile="${app.dest.properties}/env.properties"
138           file="${org.bedework.config.properties}" />
139
140     <copy tofile="${app.dest.properties}/options.xml"
141           file="${org.bedework.config.options}" >
142       <filterset>
143         <filter token="RPI-DEBUG" value="${app.debug.val}"/>
144       </filterset>
145       <filterset refid="property.filters" />
146     </copy>
147
148     <!-- Make a modified copy of the web.xml file -->
149     <copy tofile="${app.dest.web.xml}"
150           file="${app.web.xml}"
151           overwrite="yes" >
152       <filterset>
153         <filter token="RPI-DEBUG" value="${app.debug.val}"/>
154       </filterset>
155       <filterset refid="property.filters" />
156     </copy>
157
158     <antcall target="struts-stuff" inheritRefs="true" />
159
160     <!-- ===============================================================
161          Add hibernate jars and property files from calendar api.
162          =============================================================== -->
163
164     <copy todir="${app.dest.classes}">
165       <fileset dir="${org.bedework.project.calendarapi}/calCore/resources/properties" />
166       <filterset refid="property.filters" />
167     </copy>
168
169     <copy todir="${app.dest.classes}">
170       <fileset dir="${org.bedework.project.calendarapi}/calCore/resources/hbms" />
171       <filterset refid="property.filters" />
172     </copy>
173
174     <copy todir="${app.dest.lib}">
175       <fileset dir="${hibernate.jars.dir}">
176         <include name="*.jar"/>
177       </fileset>
178     </copy>
179
180     <antcall target="jboss-stuff" inheritRefs="true" />
181     <antcall target="bexchange-stuff" inheritRefs="true" />
182     <antcall target="domino-stuff" inheritRefs="true" />
183     <antcall target="google-stuff" inheritRefs="true" />
184
185     <!-- ===============================================================
186          Any jar files required
187          =============================================================== -->
188
189     <copy todir="${app.dest.lib}" overwrite="yes">
190       <fileset dir="${bin.home}">
191         <!-- jars from sub-projects needed by all -->
192         <include name="rpiaccess*.jar"/>
193         <include name="rpiutil*.jar"/>
194         <include name="bw-davdefs*.jar"/>
195         <include name="bw-davio*.jar"/>
196
197         <!-- Calendar api jars -->
198         <include name="bw-apiutil*.jar"/>
199         <include name="bw-calcore*.jar"/>
200         <include name="bw-calcorei*.jar"/>
201         <include name="bw-calenv*.jar"/>
202         <include name="bw-calfacade*.jar"/>
203         <include name="bw-calsvc*.jar"/>
204         <include name="bw-calsvci*.jar"/>
205         <include name="bw-icalendar*.jar"/>
206         <include name="bw-locale*.jar"/>
207         <include name="bw-logging*.jar"/>
208
209         <!-- Common jars for web apps -->
210         <include name="bw-appcommon*.jar"/>
211       </fileset>
212     </copy>
213
214      <!-- any extra bin files-->
215     <copy todir="${app.dest.lib}" >
216       <fileset refid="app.bin.files" />
217     </copy>
218
219     <!-- Some more standard libs -->
220     <if>
221       <not>
222         <isset property="org.bedework.build.for.jboss"/>
223       </not>
224       <then>
225         <copy todir="${app.dest.lib}" file="${log4j.jar}"/>
226       </then>
227     </if>
228     <copy todir="${app.dest.lib}" file="${lucene.core.jar}"/>
229     <copy todir="${app.dest.lib}" file="${lucene.misc.jar}"/>
230     <copy todir="${app.dest.lib}" file="${ical4j.jar}"/>
231     <copy todir="${app.dest.lib}" file="${commons-codec.jar}"/>
232     <copy todir="${app.dest.lib}" file="${commons-collections.jar}"/>
233     <copy todir="${app.dest.lib}" file="${commons-httpclient.jar}"/>
234     <copy todir="${app.dest.lib}" file="${commons-lang.jar}"/>
235     <copy todir="${app.dest.lib}" file="${commons-ssl.jar}"/>
236
237
238     <!-- add the jdbcdriver if defined -->
239     <antcall target="add.jdbcdriver" inheritRefs="true" />
240
241     <!-- tomcat -->
242     <antcall target="add.tomcat" inheritRefs="true" />
243
244      <!-- any extra lib files-->
245     <copy todir="${app.dest.lib}" >
246       <fileset refid="app.lib.files" />
247       <!-- <fileset refid="app.temp.lib.files" /> -->
248     </copy>
249
250     <!-- build the war file -->
251     <mkdir dir="${dist.home}" />
252     <delete file="${app.war.file}" />
253
254     <war warfile="${app.war.file}"
255          webxml="${app.dest.web.xml}"
256          basedir="${app.dest.war}"
257          excludes="WEB-INF/web.xml" />
258   </target>
259
260   <target name="add.jdbcdriver" if="app.jdbcdriver.jar">
261     <copy todir="${app.dest.lib}" file="${app.jdbcdriver.jar}"/>
262   </target>
263
264   <target name="add.tomcat" if="org.bedework.global.deploy.on.tomcat">
265     <property name="propval.app.tomcat.context.xml"
266               location="${app.sou.dir}/war/META-INF/context.xml" />
267     <resolveFile name="app.tomcat.context.xml"
268                  file="${propval.app.tomcat.context.xml}"
269                  base="${app.sou.dir}"/>
270
271     <copy tofile="${app.dest.metainf}/context.xml"
272           file="${app.tomcat.context.xml}"
273           overwrite="yes" >
274       <filterset refid="property.filters" />
275     </copy>
276   </target>
277
278   <target name="copy.properties" if="org.bedework.properties.dir.exists">
279     <!-- ===============================================================
280          Any property files we need for configuration, other than the
281          standard struts file, should be in the "${app.sou.dir}/properties
282          directory. They will be copied into the appropriate place for the
283          war and transformed by the above filter.
284          =============================================================== -->
285     <copy todir="${app.dest.properties}" overwrite="yes" >
286       <fileset dir="${app.sou.dir}/properties"
287                includes="*.properties"/>
288       <filterset refid="property.filters" />
289     </copy>
290   </target>
291
292   <target name="copy.servlet.properties" if="org.bedework.servlet.properties.exists">
293     <copy tofile="${app.dest.classes}/servlet.properties" file="${app.sou.properties}">
294       <filterset refid="property.filters" />
295     </copy>
296   </target>
297
298   <target name="copy.war.docs" if="org.bedework.war.docs.exists">
299     <copy todir="${app.dest.docs}">
300       <fileset dir="${app.sou.dir}/war/docs" />
301     </copy>
302   </target>
303
304   <target name="bexchange-stuff" if="org.bedework.build.caldav.bexchange">
305     <copy tofile="${app.dest.properties}/timezones.xml"
306           file="${org.bedework.project.bedework}/docs/bwtimezones.xml" />
307   </target>
308
309   <target name="domino-stuff" if="org.bedework.build.caldav.domino">
310     <copy tofile="${app.dest.properties}/timezones.xml"
311           file="${org.bedework.project.bedework}/docs/bwtimezones.xml" />
312   </target>
313
314   <target name="google-stuff" if="org.bedework.build.caldav.google">
315     <copy todir="${app.dest.lib}">
316       <fileset dir="${google.dir}">
317         <include name="*.jar"/>
318       </fileset>
319     </copy>
320
321     <copy tofile="${app.dest.properties}/timezones.xml"
322           file="${org.bedework.project.bedework}/docs/bwtimezones.xml" />
323   </target>
324
325   <!-- =================================================================
326        If this is a struts app the following gets executed.
327        We create an updated struts-config.xml file and add some jars.
328        ================================================================= -->
329
330   <target name="struts-stuff" if="org.bedework.strutsapp">
331     <!-- Copy a dummy startup file into the war. -->
332     <copy todir="${app.dest.war}">
333       <fileset dir="${app.sou.dir}/war/" includes="setup.do" />
334     </copy>
335
336     <copy todir="${app.dest.webinf}"
337           file="${app.sou.dir}/war/WEB-INF/struts-config.xml"/>
338
339     <mkdir  dir="${app.dest.webinf}/tlds"/>
340     <copy todir="${app.dest.webinf}/tlds" >
341       <fileset dir="${struts.tlds.dir}">
342         <include name="*"/>
343       </fileset>
344     </copy>
345     <copy todir="${app.dest.webinf}/tlds" >
346       <fileset dir="${org.bedework.default.lib}/tlds">
347         <include name="*"/>
348       </fileset>
349     </copy>
350
351     <if>
352       <not>
353         <isset property="xalan.in.tomcat.common.endorsed" />
354       </not>
355       <then>
356         <copy todir="${app.dest.lib}" file="${xalan.jar}"/>
357       </then>
358     </if>
359
360     <if>
361       <isset property="org.bedework.global.portal.platform" />
362       <then>
363         <!-- Add common portlet files -->
364
365         <copy todir="${app.dest.lib}" >
366           <fileset dir="${portals-bridges.jars.dir}">
367             <include name="*.jar"/>
368           </fileset>
369         </copy>
370
371         <!-- Use generic bedework portlet tld -->
372         <copy todir="${app.dest.webinf}/tlds"
373               overwrite="yes"
374               failonerror="no" >
375           <fileset dir="${app.root.dir}/resources/portlet" >
376             <include name="*.tld"/>
377           </fileset>
378         </copy>
379
380         <copy todir="${app.dest.webinf}"
381               file="${org.bedework.deploy.type.dir}/portlet/struts-portlet-config.xml"
382               overwrite="yes"
383               failonerror="no" />
384
385         <copy todir="${app.dest.webinf}"
386               file="${org.bedework.deploy.type.dir}/portlet/portlet.xml"
387               overwrite="yes"
388               failonerror="no" >
389           <filterset refid="property.filters" />
390         </copy>
391
392         <!-- Add the portal bridge controller def -->
393         <replace file="${app.dest.webinf}/struts-config.xml">
394           <replacetoken><![CDATA[<!-- portlet controller def here -->]]></replacetoken>
395           <replacevalue><![CDATA[<controller pagePattern="$M$P" inputForward="true"
396                   processorClass="org.apache.portals.bridges.struts.PortletRequestProcessor"/>]]>
397           </replacevalue>
398         </replace>
399
400         <antcall target="add.jetspeed2" inheritRefs="true" />
401         <antcall target="add.uportal2" inheritRefs="true" />
402         <antcall target="add.liferay4" inheritRefs="true" />
403
404         <replace file="${app.dest.webinf}/web.xml">
405           <replacefilter token="@PORTLET-NAME@" value="${propval.app.portlet.name}"/>
406           <replacefilter token="@PORTAL-SERVLET-CONTEXT-LISTENER@"
407                          value="${org.bedework.global.portal-servlet.context.listener}"/>
408         </replace>
409       </then>
410     </if>
411
412     <copy todir="${app.dest.lib}">
413       <fileset dir="${struts.dir}">
414         <include name="*.jar"/>
415       </fileset>
416     </copy>
417
418     <copy todir="${app.dest.lib}" file="${antlr.jar}"/>
419     <copy todir="${app.dest.lib}" file="${commons-beanutils.jar}"/>
420     <copy todir="${app.dest.lib}" file="${digester.jar}"/>
421     <copy todir="${app.dest.lib}" file="${commons-fileupload.jar}"/>
422     <copy todir="${app.dest.lib}" file="${commons-logging.jar}"/>
423     <copy todir="${app.dest.lib}" file="${commons-validator.jar}"/>
424     <copy todir="${app.dest.lib}" file="${jakarta-oro.jar}"/>
425   </target>
426
427   <!-- =================================================================
428        Jetspeed 2 modifications
429        ================================================================= -->
430
431   <target name="add.jetspeed2" if="org.bedework.build.for.jetspeed2" >
432     <copy todir="${app.dest.webinf}/tlds" >
433       <fileset dir="${org.bedework.default.lib}/${jetspeed2.jars.dir}/portals-bridges-struts">
434         <include name="*.tld"/>
435       </fileset>
436     </copy>
437   </target>
438
439   <!-- =================================================================
440        Uportal 2 modifications
441        ================================================================= -->
442
443   <target name="add.uportal2" if="org.bedework.build.for.uportal2" >
444     <copy todir="${app.dest.lib}" >
445       <fileset dir="${bin.home}">
446         <include name="bw-uportal*.jar"/>
447       </fileset>
448     </copy>
449
450     <!-- Add the portlet servlet mapping -->
451     <replace file="${app.dest.webinf}/web.xml">
452       <replacetoken><![CDATA[<!-- portlet servlet mapping here -->]]></replacetoken>
453       <replacevalue><![CDATA[<servlet-mapping>
454     <servlet-name>@PORTLET-NAME@</servlet-name>
455     <url-pattern>/@PORTLET-NAME@/*</url-pattern>
456   </servlet-mapping>]]>
457       </replacevalue>
458     </replace>
459
460   </target>
461
462   <!-- =================================================================
463        Liferay 4 modifications
464        ================================================================= -->
465
466   <target name="add.liferay4" if="org.bedework.build.for.liferay4" >
467    <!-- Add liferay config files -->
468     <copy todir="${app.dest.webinf}" >
469       <fileset dir="${app.sou.dir}/war/WEB-INF" >
470         <include name="liferay*"/>
471       </fileset>
472       <filterset refid="property.filters" />
473     </copy>
474
475     <copy todir="${app.dest.lib}" >
476       <fileset dir="${bin.home}">
477         <include name="bw-liferay*.jar"/>
478       </fileset>
479       <fileset dir="${liferay4.lib}">
480         <include name="*.jar"/>
481       </fileset>
482     </copy>
483
484     <!-- Add the portlet servlet mapping -->
485     <replace file="${app.dest.webinf}/web.xml">
486       <replacetoken><![CDATA[<!-- portlet servlet mapping here -->]]></replacetoken>
487       <replacevalue><![CDATA[<listener>
488     <listener-class>
489       @PORTAL-SERVLET-CONTEXT-LISTENER@
490     </listener-class>
491   </listener>
492   <servlet-mapping>
493     <servlet-name>@PORTLET-NAME@</servlet-name>
494     <url-pattern>/@PORTLET-NAME@/*</url-pattern>
495   </servlet-mapping>]]>
496       </replacevalue>
497     </replace>
498   </target>
499
500   <!-- =================================================================
501        If this is a j2ee app the following gets executed.
502        We create an uodated jboss-web.xml file (for jboss) and a ear
503        ================================================================= -->
504
505   <target name="jboss-stuff" if="org.bedework.build.for.jboss">
506     <copy todir="${app.dest.webinf}"
507           file="${app.sou.dir}/war/WEB-INF/jboss-web.xml">
508       <filterset refid="property.filters" />
509     </copy>
510     <antcall target="jboss-virtual-host" inheritRefs="true" />
511   </target>
512
513   <target name="jboss-virtual-host" if="org.bedework.global.virtual.host">
514     <replace file="${app.dest.webinf}/jboss-web.xml">
515       <replacetoken><![CDATA[<!-- Virtual host -->]]></replacetoken>
516       <replacevalue><![CDATA[<virtual-host>@VIRTUAL-HOST@</virtual-host>
517       ]]>
518       </replacevalue>
519     </replace>
520     <replace file="${app.dest.webinf}/jboss-web.xml">
521       <replacefilter token="@VIRTUAL-HOST@" value="${org.bedework.global.virtual.host}"/>
522     </replace>
523   </target>
524
525   <target name="build.ear" if="cal.j2ee">
526     <ant antfile="${buildear}"
527          inheritRefs="true" target="build" />
528   </target>
529 </project>
Note: See TracBrowser for help on using the browser.