root/trunk/build/buildwar.xml

Revision 2430 (checked in by douglm, 3 years ago)

Fix build after removing unnecessary WEB-INF/classes

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      These should be defined in the build properties for the application.
22
23      It is possible to define any of the app.dest properties below to override
24      the location of destination files.
25
26      In the directory
27         ${apps.sou.dir}
28      we expect an application skeleton formatted like a web-application
29      For the purposes of this build it should contain a
30      structure like
31               war - docs    (contains jsp and html for this app)
32                     WEB-INF - struts-config.xml
33                               web.xml
34                               jboss-web.xml (for jboss only)
35
36      Authors: Mike Douglass
37      =================================================================== -->
38
39 <project name="bedework.buildwar" default="build" >
40   <import file="${build.dir}/buildfilters.xml" />
41
42   <if>
43     <isset property="org.bedework.global.portal.platform" />
44     <then>
45       <import file="${build.dir}/portals/${org.bedework.global.portal.platform}War.xml" />
46     </then>
47   </if>
48
49   <import file="${build.dir}/platforms/${org.bedework.global.deploy.platform}War.xml" />
50
51   <target name="init" depends="init.common">
52     <if>
53       <isset property="org.bedework.global.build.ear" />
54       <then>
55         <!-- Common library in ear file -->
56         <property name="app.dest.lib"
57                   location="${org.bedework.ear.templib}" />
58
59         <!-- Properties all go into a single jar file at termination -->
60         <property name="app.dest.classes"
61                   location="${org.bedework.ear.properties.dir}" />
62       </then>
63       <else>
64         <!-- Library in war file -->
65         <property name="app.dest.lib"
66                   location="${app.dest.webinf}/lib" />
67
68         <!-- Properties in the war file -->
69         <property name="app.dest.classes"
70                   location="${app.dest.webinf}/classes" />
71       </else>
72     </if>
73     <property name="app.dest.properties.old"
74               location="${app.dest.classes}/properties/calendar" />
75     <property name="app.dest.properties"
76               location="${app.dest.classes}/properties" />
77   </target>
78
79   <target name="init.common">
80     <!-- Destinations - where we build an unwrapped war -->
81     <property name="app.dest.war"
82               location="${org.bedework.temp.wars.home}/${propval.app.war.name}.war" />
83     <property name="app.dest.docs"
84               location="${app.dest.war}/docs" />
85     <property name="app.dest.webinf"
86               location="${app.dest.war}/WEB-INF" />
87     <property name="app.dest.metainf"
88               location="${app.dest.war}/META-INF" />
89
90     <!--temp web.xml location  -->
91     <property name="app.temp.web.xml"
92               location="${app.dest.webinf}/tempweb.xml" />
93
94     <!--final web.xml location  -->
95     <property name="app.dest.web.xml"
96               location="${app.dest.webinf}/web.xml" />
97
98     <property name="app.war.file"
99               location="${dist.home}/${propval.app.war.name}.war" />
100
101     <!-- default web.xml -->
102     <property name="propval.app.web.xml"
103               value="war/WEB-INF/web.xml" />
104
105               <!--
106     <property name="app.web.xml"
107               location="${propval.app.web.xml}" />
108               -->
109     <resolveFile name="app.web.xml"
110                  file="${propval.app.web.xml}"
111                  base="${app.sou.dir}"/>
112
113     <property name="app.sou.properties"
114               location="${app.sou.dir}/war/WEB-INF/classes/servlet.properties" />
115   </target>
116
117   <target name="build" depends="init">
118     <echo message="**************************************************" />
119     <echo message=" * Building war ${propval.app.war.name}"/>
120     <echo message="**************************************************" />
121
122     <delete dir="${app.dest.war}" />
123
124     <!-- Add modifed login pages -->
125     <copy todir="${app.dest.docs}/login" failonerror="false" >
126       <fileset dir="${org.bedework.common.resources}/login" />
127       <filterset>
128         <filter token="DISPLAY-NAME" value="${propval.app.display.name}"/>
129       </filterset>
130     </copy>
131
132     <!-- ===============================================================
133          We copy 3 sets of properties.
134
135          First (for struts) are the servlet properties which ends up as
136               classes/servlet.properties
137          Next we copy in a set of generic property files and then with
138          overwrite we copy in a set of base specific files.
139
140          All are updated with new values.
141          =============================================================== -->
142
143     <if>
144       <available file="${app.sou.dir}/war/docs" type="dir" />
145       <then>
146         <copy todir="${app.dest.docs}">
147           <fileset dir="${app.sou.dir}/war/docs" />
148         </copy>
149       </then>
150     </if>
151
152     <!-- ===============================================================
153          Any property files we need for configuration, other than the
154          standard struts file, should be in the "${app.sou.dir}/properties
155          directory. They will be copied into the appropriate place for the
156          war and transformed by the above filter.
157          =============================================================== -->
158
159     <!-- Create the runtime options file -->
160     <mkdir dir="${app.dest.properties}" />
161
162     <if>
163       <available file="${app.sou.dir}/properties" type="dir" />
164       <then>
165         <copy todir="${app.dest.properties}" overwrite="yes" >
166           <fileset dir="${app.sou.dir}/properties"
167                    includes="*.properties"/>
168           <filterset refid="property.filters" />
169         </copy>
170       </then>
171     </if>
172
173     <copy tofile="${app.dest.properties}/options.xml"
174           file="${org.bedework.config.options}" >
175       <filterset>
176         <filter token="RPI-DEBUG" value="${app.debug.val}"/>
177       </filterset>
178       <filterset refid="property.filters" />
179     </copy>
180
181     <!-- Temp do it again -->
182     <mkdir dir="${app.dest.properties.old}" />
183
184     <copy tofile="${app.dest.properties.old}/options.xml"
185           file="${org.bedework.config.options}" >
186       <filterset>
187         <filter token="RPI-DEBUG" value="${app.debug.val}"/>
188       </filterset>
189       <filterset refid="property.filters" />
190     </copy>
191
192     <if>
193       <available file="${app.sou.dir}/war/WEB-INF/classes" type="dir" />
194       <then>
195                     <copy todir="${app.dest.classes}">
196                       <fileset dir="${app.sou.dir}/war/WEB-INF/classes"
197                                includes="*"/>
198                       <filterset refid="property.filters" />
199                     </copy>
200       </then>
201     </if>
202
203         <!-- Make our own servlet.properties file for struts applications
204     <copy tofile="${app.dest.classes}/servlet.properties" file="${app.sou.properties}">
205       <filterset refid="property.filters" />
206     </copy>
207     -->
208
209     <copy tofile="${app.dest.classes}/sysevents.properties"
210           file="${org.bedework.config.sysevents.properties}" />
211
212     <!-- ===============================================================
213          Add hibernate jars and property files from calendar api.
214          =============================================================== -->
215
216     <copy todir="${app.dest.classes}">
217       <fileset dir="${org.bedework.project.calendarapi}/calCore/resources/properties" />
218       <filterset refid="property.filters" />
219     </copy>
220
221     <copy todir="${app.dest.classes}">
222       <fileset dir="${org.bedework.project.calendarapi}/calCore/resources/hbms" />
223       <filterset refid="property.filters" />
224     </copy>
225
226     <!-- Make a temp copy of the web.xml file -->
227     <copy tofile="${app.temp.web.xml}" file="${app.web.xml}"
228           overwrite="yes" />
229
230     <antcall target="struts-stuff" inheritRefs="true" />
231
232     <!-- Filter the temp copy of the web.xml file -->
233     <copy tofile="${app.dest.web.xml}"
234           file="${app.temp.web.xml}"
235           overwrite="yes" >
236       <filterset>
237         <filter token="RPI-DEBUG" value="${app.debug.val}"/>
238       </filterset>
239       <filterset refid="property.filters" />
240     </copy>
241
242     <delete file="${app.temp.web.xml}" />
243
244     <!-- Add the contex root to the file. Note that newline is required -->
245     <echo file="${org.bedework.global.context.roots}" append="yes">
246 ${propval.app.war.name}.context=${propval.app.context.root}
247     </echo>
248
249     <copy todir="${app.dest.lib}" file="${org.bedework.appjar.antlr}" />
250     <copy todir="${app.dest.lib}" file="${org.bedework.appjar.asm-attrs}" />
251     <copy todir="${app.dest.lib}" file="${org.bedework.appjar.asm}" />
252     <copy todir="${app.dest.lib}" file="${org.bedework.appjar.cglib}" />
253     <copy todir="${app.dest.lib}" file="${org.bedework.appjar.dom4j}" />
254     <copy todir="${app.dest.lib}" file="${org.bedework.appjar.ehcache}" />
255     <copy todir="${app.dest.lib}" file="${org.bedework.appjar.hibernate}" />
256     <copy todir="${app.dest.lib}" file="${org.bedework.appjar.javassist}" />
257     <copy todir="${app.dest.lib}" file="${org.bedework.appjar.jgroups}" />
258     <copy todir="${app.dest.lib}" file="${org.bedework.appjar.jta}" />
259     <copy todir="${app.dest.lib}" file="${org.bedework.appjar.slf4j-api}" />
260     <copy todir="${app.dest.lib}" file="${org.bedework.appjar.slf4j-log4j12}" />
261
262     <!-- jms support -->
263     <copy todir="${app.dest.lib}" file="${org.bedework.appjar.activemq-core}" />
264     <copy todir="${app.dest.lib}"
265           file="${org.bedework.appjar.geronimo-j2ee-management_1.0_spec}" />
266     <copy todir="${app.dest.lib}" file="${org.bedework.appjar.jms}" />
267
268     <antcall target="bexchange-stuff" inheritRefs="true" />
269     <antcall target="domino-stuff" inheritRefs="true" />
270     <antcall target="google-stuff" inheritRefs="true" />
271
272     <!-- ===============================================================
273          Any jar files required
274          =============================================================== -->
275
276     <echo message="+++++++++++  bw-logging at ${org.bedework.appjar.bw-logging}" />
277     <copy todir="${app.dest.lib}" file="${org.bedework.appjar.bw-annotations}" />
278     <copy todir="${app.dest.lib}" file="${org.bedework.appjar.rpiaccess}" />
279     <copy todir="${app.dest.lib}" file="${org.bedework.appjar.rpiutil}" />
280     <copy todir="${app.dest.lib}" file="${org.bedework.appjar.bw-davio}" />
281     <copy todir="${app.dest.lib}" file="${org.bedework.appjar.bw-apiutil}" />
282     <copy todir="${app.dest.lib}" file="${org.bedework.appjar.bw-calcore}" />
283     <copy todir="${app.dest.lib}" file="${org.bedework.appjar.bw-calcorei}" />
284     <copy todir="${app.dest.lib}" file="${org.bedework.appjar.bw-calfacade}" />
285     <copy todir="${app.dest.lib}" file="${org.bedework.appjar.bw-calsvc}" />
286     <copy todir="${app.dest.lib}" file="${org.bedework.appjar.bw-calsvci}" />
287     <copy todir="${app.dest.lib}" file="${org.bedework.appjar.bw-client}" />
288     <copy todir="${app.dest.lib}" file="${org.bedework.appjar.bw-icalendar}" />
289     <copy todir="${app.dest.lib}" file="${org.bedework.appjar.bw-logging}" />
290     <copy todir="${app.dest.lib}" file="${org.bedework.appjar.bw-mail}" />
291     <copy todir="${app.dest.lib}" file="${org.bedework.appjar.bw-sysevents}" />
292     <copy todir="${app.dest.lib}" file="${org.bedework.appjar.bw-appcommon}" />
293
294     <copy todir="${app.dest.lib}" file="${org.bedework.appjar.lucene-core}"/>
295     <copy todir="${app.dest.lib}" file="${org.bedework.appjar.lucene-misc}"/>
296     <copy todir="${app.dest.lib}" file="${org.bedework.appjar.ical4j}"/>
297     <copy todir="${app.dest.lib}" file="${org.bedework.appjar.commons-codec}"/>
298     <copy todir="${app.dest.lib}" file="${org.bedework.appjar.commons-collections}"/>
299     <copy todir="${app.dest.lib}" file="${org.bedework.appjar.commons-httpclient}"/>
300     <copy todir="${app.dest.lib}" file="${org.bedework.appjar.commons-lang}"/>
301     <copy todir="${app.dest.lib}" file="${org.bedework.appjar.commons-ssl}"/>
302
303     <!-- Mail related stuff -->
304     <copy todir="${app.dest.lib}" file="${org.bedework.appjar.activation}" />
305     <copy todir="${app.dest.lib}" file="${org.bedework.appjar.dsn}" />
306     <copy todir="${app.dest.lib}" file="${org.bedework.appjar.imap}" />
307     <copy todir="${app.dest.lib}" file="${org.bedework.appjar.mailapi}" />
308     <copy todir="${app.dest.lib}" file="${org.bedework.appjar.pop3}" />
309     <copy todir="${app.dest.lib}" file="${org.bedework.appjar.smtp}" />
310
311     <!-- any extra files-->
312     <copy todir="${app.dest.lib}" >
313       <fileset dir="${org.bedework.temp.extrajars.dir}" />
314     </copy>
315
316     <!-- Platform specific -->
317     <antcall target="doPlatform" inheritRefs="true" />
318
319     <!-- build the war file -->
320     <mkdir dir="${dist.home}" />
321     <delete file="${app.war.file}" />
322
323     <war warfile="${app.war.file}"
324          webxml="${app.dest.web.xml}"
325          basedir="${app.dest.war}"
326          excludes="WEB-INF/web.xml" />
327   </target>
328
329   <target name="bexchange-stuff" if="org.bedework.build.caldav.bexchange">
330   </target>
331
332   <target name="domino-stuff" if="org.bedework.build.caldav.domino">
333   </target>
334
335   <target name="google-stuff" if="org.bedework.build.caldav.google">
336     <copy todir="${app.dest.lib}">
337       <fileset dir="${google.dir}">
338         <include name="*.jar"/>
339       </fileset>
340     </copy>
341   </target>
342
343   <!-- =================================================================
344        If this is a struts app the following gets executed.
345        We create an updated struts-config.xml file and add some jars.
346        ================================================================= -->
347
348   <target name="struts-stuff" if="org.bedework.strutsapp">
349         <!-- Make our own servlet.properties file for struts applications -->
350     <echo file="${app.dest.classes}/servlet.properties" ><![CDATA[#
351 # ========================================================================
352 # This file contains all properties for servlet applications.
353 # It cannot be application specific as the jboss build creates a
354 # single set of resources on the classpath.
355 # ========================================================================
356 #
357
358 # ========================================================================
359 # Properties for the xml/xslt based calendar web applications
360 # ========================================================================
361 #
362 # author Mike Douglass douglm rpi.edu
363
364 # This is only here because the jetspeed portal-struts bridge does not seem to be
365 # passing across the servlet context.
366 #org.bedework.svcicb.sessionAttrName=org.bedework.admin.svcicb.sessionattrname.@APP-NAME@
367
368 # These are required by the Struts framework
369 errors.header=<errors><ul>
370 errors.footer=</ul></errors>
371
372 messages.header=<messages><ul>
373 messages.footer=</ul></messages>
374
375 edu.rpi.sss.util.action.noactionerrors=yes
376
377 applicationResources=<li>Cannot load application resources bundle {0}</li>
378
379 # set the default content type - html for jsp, xml for xml/xslt.
380 #edu.rpi.sss.util.action.contenttype=@DEFAULT-CONTENTTYPE@
381 edu.rpi.sss.util.action.contenttype=text/xml
382
383 edu.rpi.sss.util.error.exc=<li>Exception: {0}</li>
384
385 # Turn nocache headers on. We don't use the standard struts directives
386 # because we need to be able to turn nocache off for a single response.
387 # This gets around an IE problem with delivery of files.
388 edu.rpi.sss.util.action.nocache=yes
389
390 org.bedework.security.prefix=@SECURITY-PREFIX@
391
392 edu.rpi.sss.util.action.logprefix=@APP-NAME@
393
394 # Roles we need to know about - init action uses these
395 # (Not using roles in the current system)
396 #org.bedework.role.admin=@SECURITY-PREFIX@.admin
397 #org.bedework.role.contentadmin=@SECURITY-PREFIX@.contentadmin
398 #org.bedework.role.alert=@SECURITY-PREFIX@.alerts
399 #org.bedework.role.owner=@SECURITY-PREFIX@.owner
400 ]]></echo>
401
402     <!-- Replace the tokens -->
403     <replace file="${app.dest.classes}/servlet.properties">
404       <replacefilter token="@SECURITY-PREFIX@"
405                      value="${propval.app.security.prefix}" />
406       <replacefilter token="@APP-NAME@"
407                      value="${propval.app.name}" />
408       <replacefilter token="@DEFAULT-CONTENTTYPE@"
409                      value="${propval.app.default.contenttype}" />
410     </replace>
411        
412     <!-- Copy a dummy startup file into the war. -->
413     <copy todir="${app.dest.war}">
414       <fileset dir="${app.sou.dir}/war/" includes="setup.do" />
415     </copy>
416
417     <copy todir="${app.dest.webinf}"
418           file="${app.sou.dir}/war/WEB-INF/struts-config.xml"/>
419
420     <mkdir  dir="${app.dest.webinf}/tlds"/>
421     <copy todir="${app.dest.webinf}/tlds" >
422       <fileset dir="${org.bedework.struts.tlds}">
423         <include name="*"/>
424       </fileset>
425     </copy>
426
427     <if>
428       <isset property="org.bedework.global.portal.platform" />
429       <then>
430         <antcall target="doPortal" inheritRefs="true" />
431       </then>
432     </if>
433
434     <copy todir="${app.dest.lib}" file="${org.bedework.appjar.serializer}"/>
435     <copy todir="${app.dest.lib}" file="${org.bedework.appjar.xalan}"/>
436     <copy todir="${app.dest.lib}" file="${org.bedework.appjar.struts}"/>
437
438     <copy todir="${app.dest.lib}" file="${org.bedework.appjar.antlr}"/>
439     <copy todir="${app.dest.lib}" file="${org.bedework.appjar.commons-beanutils}"/>
440     <copy todir="${app.dest.lib}" file="${org.bedework.appjar.commons-digester}"/>
441     <copy todir="${app.dest.lib}" file="${org.bedework.appjar.commons-fileupload}"/>
442     <copy todir="${app.dest.lib}" file="${org.bedework.appjar.commons-logging}"/>
443     <copy todir="${app.dest.lib}" file="${org.bedework.appjar.commons-validator}"/>
444     <copy todir="${app.dest.lib}" file="${org.bedework.appjar.jakarta-oro}"/>
445     <copy todir="${app.dest.lib}" file="${org.bedework.appjar.jstl}"/>
446     <copy todir="${app.dest.lib}" file="${org.bedework.appjar.jstl-standard}"/>
447   </target>
448 </project>
Note: See TracBrowser for help on using the browser.