root/trunk/build/platforms/jbossWar.xml

Revision 3105 (checked in by douglm, 2 years ago)

Remove definition of property "base.name" from (almost) every build file. Was not used.
Stop defining, creating and copying to libapi. Wasn't in use.

Remove build directory from every project and use the build files in the main bedework project. improves consistency and maintainability. Also allowed some bugs to be fixed.

Allow setting of message level during build and set it at quiet. Allows error messages to be more obvious.

Create macro to handle the common property definitions. Reduces size and complexity of build files.

Add a build-jar macro. Removes need for build files for sub-modules. Partway through converting to use that.

Line 
1 <?xml version="1.0"?>
2
3 <!-- ===================================================================
4      This file is imported by buildwar.xml and adds the targets
5      which will be invoked by the buildwar targets.
6         addLibs: add libraries for this platform
7         doPlatform - misc stuff
8         deployWar: deploy the war to the server
9         deployEar: deploy the ear to the server
10      =================================================================== -->
11
12 <project name="bedework.platformWar" default="doPlatform" >
13   <target name="doPlatform" >
14     <!-- ===============================================================
15          We create an updated jboss-web.xml file (for jboss) and a ear
16          =============================================================== -->
17
18     <copy todir="${app.dest.webinf}"
19           file="${app.sou.dir}/war/WEB-INF/jboss-web.xml">
20       <filterset refid="property.filters" />
21     </copy>
22
23     <if>
24       <isset property="propval.app.virtual.host" />
25       <then>
26         <replace file="${app.dest.webinf}/jboss-web.xml">
27           <replacetoken><![CDATA[<!-- Virtual host -->]]></replacetoken>
28           <replacevalue><![CDATA[<virtual-host>@VIRTUAL-HOST@</virtual-host>
29           ]]>
30           </replacevalue>
31         </replace>
32         <replace file="${app.dest.webinf}/jboss-web.xml">
33           <replacefilter token="@VIRTUAL-HOST@" value="${propval.app.virtual.host}"/>
34         </replace>
35       </then>
36     </if>
37   </target>
38  
39   <!-- ================================================================
40        Add libraries
41        ================================================================ -->
42
43   <target name="addLibs">
44     <if>
45       <not>
46         <isset property="org.bedework.global.build.ear" />
47       </not>
48       <then>
49         <!-- Library in war file -->
50         <property name="app.dest.lib"
51                   location="${app.dest.webinf}/lib" />
52         <if>
53           <not>
54             <isset property="propval.app.no.defaultlibs" />
55           </not>
56           <then>
57             <antcall target="copyLibs" inheritRefs="true" />
58           </then>
59         </if>
60       </then>
61       <else>
62         <!-- Preserve extra jars for later -->
63         <copy todir="${org.bedework.temp.ear.extrajars.dir}" >
64           <fileset dir="${org.bedework.temp.extrajars.dir}" />
65         </copy>
66       </else>
67     </if>
68   </target>
69  
70   <!-- ================================================================
71        Deploy war
72        ================================================================ -->
73
74   <target name="deployWar">
75     <if>
76       <not>
77         <isset property="org.bedework.global.build.ear" />
78       </not>
79       <then>
80         <infoMsg message="* =========== Deploying standalone app ${app.war.file} into ${org.bedework.appserver.dir}/${propval.app.deploy.dir}" />
81
82         <!-- copy the war file. -->
83         <copy todir="${org.bedework.appserver.dir}/${propval.app.deploy.dir}" file="${app.war.file}"
84               overwrite="yes" />
85
86         <!-- Delete expanded version -->
87         <delete dir="${org.bedework.appserver.dir}/${propval.app.deploy.dir}/${propval.app.war.name}" />
88       </then>
89     </if>
90   </target>
91    
92   <!-- ================================================================
93        Deploy ear
94        ================================================================ -->
95
96   <target name="deployEar">
97     <if>
98       <equals arg1="${org.bedework.global.ear.zipped}"
99               arg2="yes" />
100       <then>
101         <property name="org.bedework.ear.dir"
102                   location="${org.bedework.temp.dir}/${org.bedework.ear.name}" />
103         <property name="org.bedework.ear.file"
104                   location="${org.bedework.temp.dir}/${org.bedework.ear.name}.ear" />
105       </then>
106       <else>
107         <property name="org.bedework.ear.dir"
108                   location="${org.bedework.temp.dir}/${org.bedework.ear.name}.ear" />
109       </else>
110     </if>
111
112     <delete dir="${org.bedework.ear.dir}" />
113     <mkdir dir="${org.bedework.ear.dir}" />
114
115     <property name="org.bedework.ear.properties.jar"
116               value="${org.bedework.ear.dir}/bw-ear-properties.jar"/>
117
118     <!-- Common library in ear file -->
119     <property name="app.dest.lib"
120               location="${org.bedework.ear.dir}" />
121     <if>
122       <not>
123         <isset property="propval.app.no.defaultlibs" />
124       </not>
125       <then>
126         <antcall target="copyLibs" inheritRefs="true" />
127       </then>
128     </if>
129
130     <!-- And the extra jars we preserved -->
131     <copy todir="${app.dest.lib}" >
132       <fileset dir="${org.bedework.temp.ear.extrajars.dir}" />
133     </copy>
134        
135     <infoMsg message="* =========== Building ear file ${org.bedework.ear.dir} for jboss deployment" />
136
137     <jar jarfile="${org.bedework.ear.properties.jar}">
138       <fileset dir="${org.bedework.ear.properties.dir}"/>
139     </jar>
140
141     <debugMsg message="outFile=${org.bedework.ear.dir}/META-INF/application.xml
142                         warDir=${org.bedework.temp.dir}/wars
143                         contexts=${org.bedework.global.context.roots}" />
144
145         <mkdir dir="${org.bedework.ear.dir}/META-INF" />
146        
147     <applicationXml displayName="Bedework calendar suite"
148                     outFile="${org.bedework.ear.dir}/META-INF/application.xml"
149                     warDir="${org.bedework.temp.dir}/wars"
150                     contexts="${org.bedework.global.context.roots}">
151       <fileset dir="${org.bedework.ear.dir}">
152         <include name="*.jar"/>
153       </fileset>
154     </applicationXml>
155    
156     <echo file="${org.bedework.ear.dir}/META-INF/jboss-app.xml"><![CDATA[<?xml version="1.0" encoding="UTF-8"?>
157 <jboss-app>
158    <loader-repository>
159      org.bedework:archive=@EAR_NAME@
160      <loader-repository-config>java2ParentDelegation=false</loader-repository-config>
161    </loader-repository>
162 </jboss-app>
163 ]]></echo>
164      
165     <replace file="${org.bedework.ear.dir}/META-INF/jboss-app.xml"
166              token="@EAR_NAME@"
167              value="${app.ear.file.name}"/>
168
169     <if>
170       <and>
171         <isset property="ear.meta.dir" />
172         <available file="${ear.meta.dir}" type="dir" />
173       </and>
174       <then>
175         <copy todir="${org.bedework.ear.dir}/META-INF">
176           <fileset dir="${ear.meta.dir}" />
177           <filterset refid="property.filters" />
178         </copy>
179       </then>
180     </if>
181          
182     <manifest file="${org.bedework.ear.dir}/META-INF/MANIFEST.MF" />
183
184     <if>
185       <equals arg1="${org.bedework.global.ear.wars.zipped}"
186               arg2="yes" />
187       <then>
188         <copy toDir="${org.bedework.ear.dir}">
189           <fileset dir="${dist.home}"
190                    includes="*.war" />
191         </copy>
192       </then>
193       <else>
194         <copy toDir="${org.bedework.ear.dir}">
195           <fileset dir="${org.bedework.temp.wars.home}"/>
196         </copy>
197       </else>
198     </if>
199
200     <if>
201       <equals arg1="${org.bedework.global.ear.zipped}"
202               arg2="yes" />
203       <then>
204          <zip destfile="${org.bedework.ear.file}"
205              basedir="${org.bedework.ear.dir}"/>
206       </then>
207     </if>
208
209     <!-- copy the ear - at the moment copy the uncompressed. -->
210
211     <if>
212       <isset property="org.bedework.appserver.deploy.dir" />
213       <then>
214         <delete dir="${org.bedework.appserver.deploy.dir}/${app.ear.file.name}" />
215         <mkdir dir="${org.bedework.appserver.deploy.dir}/${app.ear.file.name}" />
216         <copy todir="${org.bedework.appserver.deploy.dir}/${app.ear.file.name}">
217           <fileset dir="${org.bedework.ear.dir}"/>
218         </copy>
219       </then>
220     </if>
221   </target>
222  
223   <!-- ================================================================
224        Private target to copy libraries
225        ================================================================ -->
226
227   <target name="copyLibs">
228     <!-- hibernate jars -->
229     <copy todir="${app.dest.lib}" file="${org.bedework.appjar.antlr}" />
230     <copy todir="${app.dest.lib}" file="${org.bedework.appjar.asm-attrs}" />
231     <copy todir="${app.dest.lib}" file="${org.bedework.appjar.asm}" />
232     <copy todir="${app.dest.lib}" file="${org.bedework.appjar.cglib}" />
233     <copy todir="${app.dest.lib}" file="${org.bedework.appjar.dom4j}" />
234     <copy todir="${app.dest.lib}" file="${org.bedework.appjar.ehcache}" />
235     <copy todir="${app.dest.lib}" file="${org.bedework.appjar.hibernate}" />
236     <copy todir="${app.dest.lib}" file="${org.bedework.appjar.javassist}" />
237     <copy todir="${app.dest.lib}" file="${org.bedework.appjar.jta}" />
238     <copy todir="${app.dest.lib}" file="${org.bedework.appjar.slf4j-api}" />
239     <copy todir="${app.dest.lib}" file="${org.bedework.appjar.slf4j-log4j12}" />
240
241     <if>
242       <isset property="org.bedework.build.caldav.google" />
243       <then>
244         <copy todir="${app.dest.lib}">
245           <fileset dir="${google.dir}">
246             <include name="*.jar"/>
247           </fileset>
248         </copy>
249       </then>
250     </if>
251
252     <!-- ===============================================================
253          Any jar files required
254          =============================================================== -->
255
256     <copy todir="${app.dest.lib}" file="${org.bedework.appjar.bw-annotations}" />
257     <copy todir="${app.dest.lib}" file="${org.bedework.appjar.rpiaccess}" />
258     <copy todir="${app.dest.lib}" file="${org.bedework.appjar.rpiutil}" />
259     <copy todir="${app.dest.lib}" file="${org.bedework.appjar.bw-davio}" />
260     <copy todir="${app.dest.lib}" file="${org.bedework.appjar.bw-apiutil}" />
261     <copy todir="${app.dest.lib}" file="${org.bedework.appjar.bw-calcore}" />
262     <copy todir="${app.dest.lib}" file="${org.bedework.appjar.bw-calcorei}" />
263     <copy todir="${app.dest.lib}" file="${org.bedework.appjar.bw-calfacade}" />
264     <copy todir="${app.dest.lib}" file="${org.bedework.appjar.bw-calsvc}" />
265     <copy todir="${app.dest.lib}" file="${org.bedework.appjar.bw-calsvci}" />
266     <copy todir="${app.dest.lib}" file="${org.bedework.appjar.bw-client}" />
267     <copy todir="${app.dest.lib}" file="${org.bedework.appjar.bw-icalendar}" />
268     <copy todir="${app.dest.lib}" file="${org.bedework.appjar.bw-logging}" />
269     <copy todir="${app.dest.lib}" file="${org.bedework.appjar.bw-mail}" />
270     <copy todir="${app.dest.lib}" file="${org.bedework.appjar.bw-sysevents}" />
271     <copy todir="${app.dest.lib}" file="${org.bedework.appjar.bw-appcommon}" />
272
273     <copy todir="${app.dest.lib}" file="${org.bedework.appjar.lucene-core}"/>
274     <copy todir="${app.dest.lib}" file="${org.bedework.appjar.lucene-misc}"/>
275     <copy todir="${app.dest.lib}" file="${org.bedework.appjar.backport-util-concurrent}"/>
276     <copy todir="${app.dest.lib}" file="${org.bedework.appjar.ical4j}"/>
277     <copy todir="${app.dest.lib}" file="${org.bedework.appjar.ical4j-vcard}"/>
278     <copy todir="${app.dest.lib}" file="${org.bedework.appjar.commons-codec}"/>
279     <copy todir="${app.dest.lib}" file="${org.bedework.appjar.commons-collections}"/>
280     <copy todir="${app.dest.lib}" file="${org.bedework.appjar.commons-httpclient}"/>
281     <copy todir="${app.dest.lib}" file="${org.bedework.appjar.commons-lang}"/>
282     <copy todir="${app.dest.lib}" file="${org.bedework.appjar.commons-ssl}"/>
283
284     <!-- Mail related stuff -->
285     <copy todir="${app.dest.lib}" file="${org.bedework.appjar.activation}" />
286     <copy todir="${app.dest.lib}" file="${org.bedework.appjar.dsn}" />
287     <copy todir="${app.dest.lib}" file="${org.bedework.appjar.imap}" />
288     <copy todir="${app.dest.lib}" file="${org.bedework.appjar.mailapi}" />
289     <copy todir="${app.dest.lib}" file="${org.bedework.appjar.pop3}" />
290     <copy todir="${app.dest.lib}" file="${org.bedework.appjar.smtp}" />
291
292     <!-- any extra files-->
293     <copy todir="${app.dest.lib}" >
294       <fileset dir="${org.bedework.temp.extrajars.dir}" />
295     </copy>
296
297         <!-- Add the struts stuff -->
298     <copy todir="${app.dest.lib}" file="${org.bedework.appjar.serializer}"/>
299     <copy todir="${app.dest.lib}" file="${org.bedework.appjar.xalan}"/>
300     <copy todir="${app.dest.lib}" file="${org.bedework.appjar.struts}"/>
301
302     <copy todir="${app.dest.lib}" file="${org.bedework.appjar.commons-beanutils}"/>
303     <copy todir="${app.dest.lib}" file="${org.bedework.appjar.commons-digester}"/>
304     <copy todir="${app.dest.lib}" file="${org.bedework.appjar.commons-fileupload}"/>
305     <copy todir="${app.dest.lib}" file="${org.bedework.appjar.commons-validator}"/>
306     <copy todir="${app.dest.lib}" file="${org.bedework.appjar.jakarta-oro}"/>
307     <copy todir="${app.dest.lib}" file="${org.bedework.appjar.jstl}"/>
308     <copy todir="${app.dest.lib}" file="${org.bedework.appjar.jstl-standard}"/>
309   </target>
310 </project>
Note: See TracBrowser for help on using the browser.