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

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

Test mailer class using javax.mail classes.

Does not do much error checking but will allow interoperability testing of schedulting.

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