-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.xml
executable file
·356 lines (314 loc) · 10.9 KB
/
build.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
<project name="Shopping Cart" default="build-ear" basedir=".">
<!-- This is a basic build script, only the minimums here -->
<!-- Tell ant to use my environment variables -->
<property environment="env"/>
<property file="./local.properties"/>
<property file="./build.properties"/>
<property file="./${app-server}.properties"/>
<!-- Setting up the project classpath -->
<path id="project.class.path">
<fileset dir="${lib.web.dir}">
<include name="**/*.jar" />
</fileset>
<fileset dir="${lib.app.dir}">
<include name="**/*.jar" />
</fileset>
<fileset dir="${lib.build.dir}">
<include name="**/*.jar" />
</fileset>
<pathelement path="${java.src.dir}" />
</path>
<!-- Remove the application from the container -->
<target name="cleanWebApp">
<delete dir="${deploy.ear.path}" includeEmptyDirs="true" />
<!-- delete file="${deploy.dir}/jboss-j2ee-ds.xml" / -->
</target>
<!-- Clean the build environment. (Does not undeploy the application) -->
<target name="clean" depends="cleanClasses">
<delete includeEmptyDirs="true" failonerror="false">
<fileset dir="${build.dir}"/>
<fileset dir="${dist.dir}"/>
</delete>
</target>
<target name="undeploy">
<delete includeEmptyDirs="true">
<fileset dir="${deploy.ear.path}"/>
</delete>
</target>
<target name="undeploy.war">
<delete file="${deploy.war.path}"/>
</target>
<target name="undeploy.ear">
<delete file="${deploy.ear.path}"/>
</target>
<!-- Initial preparations -->
<target name="prep">
<mkdir dir="${lib.web.dir}"/>
<mkdir dir="${lib.app.dir}"/>
<mkdir dir="${lib.build.dir}"/>
<mkdir dir="${build.dir}"/>
<mkdir dir="${build.app.dir}"/>
<mkdir dir="${build.app.dir}/META-INF"/>
<mkdir dir="${build.app-lib.dir}"/>
<mkdir dir="${build.ejb-jar.dir}"/>
<mkdir dir="${build.ejb-jar.dir}/META-INF"/>
<mkdir dir="${build.web.dir}"/>
<mkdir dir="${build.web.dir}/WEB-INF"/>
<mkdir dir="${build.web.dir}/WEB-INF/classes"/>
<mkdir dir="${build.web.dir}/META-INF"/>
<!-- mkdir dir="${build.web-lib.dir}"/> -->
<mkdir dir="${build.web-jar.dir}"/>
<mkdir dir="${build.web-jar.dir}/META-INF"/>
<mkdir dir="${java.compile.dir}"/>
<mkdir dir="${dist.dir}"/>
</target>
<!-- Compile java code -->
<target name="compile" depends="prep">
<javac srcdir="${java.src.dir}"
destdir="${java.compile.dir}"
debug="on"
deprecation="on"
target="${java.compile.target}">
<compilerarg value="-Xlint:unchecked" />
<include name="**/*.java"/>
<classpath refid="project.class.path"/>
</javac>
</target>
<!-- Delete compiled classes -->
<target name="cleanClasses">
<delete dir="${java.compile.dir}" />
</target>
<target name="prep-ear">
<!-- Copy all jars required on EAR classpath -->
<copy todir="${build.app-lib.dir}">
<fileset dir="${lib.app.dir}"/>
</copy>
<!-- Copy EAR level resources-->
<copy todir="${build.app.dir}">
<fileset dir="${config.resources.dir}"
includesfile="${config.app.files.includes}"
excludesfile="${config.app.files.excludes}" />
</copy>
<manifest file="${build.app.dir}/META-INF/MANIFEST.MF"/>
<replace dir="${build.app.dir}" includes="**"
token="@project.name@" value="${project.name}"/>
<replace dir="${build.app.dir}" includes="**"
token="@app.web.name@" value="${app.web.name}"/>
<replace dir="${build.app.dir}" includes="**"
token="@app.ejb-jar.name@" value="${app.ejb-jar.name}"/>
<replace dir="${build.app.dir}" includes="**"
token="@app.web-jar.name@" value="${app.web-jar.name}"/>
</target>
<!-- Create the exploded War directory -->
<target name="build-war" depends="compile, prep, build-web-jar">
<!-- Copy JSPs, and web files -->
<copy todir="${build.web.dir}">
<fileset dir="${web.src.dir}"/>
</copy>
<!-- Copy WEB-INF files -->
<copy todir="${build.web.dir}/WEB-INF">
<fileset dir="${config.web-inf.dir}"
excludesfile="${config.web-inf.excludes}" />
</copy>
<!-- Copy all jars required on WAR classpath -->
<copy todir="${build.web-lib.dir}">
<fileset dir="${lib.web.dir}"/>
</copy>
<copy todir="${build.web.dir}/WEB-INF/classes">
<fileset dir="${config.resources.dir}"
includesfile="${config.web-classes.files.includes}"
excludesfile="${config.web-classes.files.excludes}" />
</copy>
<jar destfile="${build.web.dir}/WEB-INF/lib/${app.web-jar.name}">
<fileset dir="${build.web-jar.dir}"/>
</jar>
<antcall target="build-war.${app-server}">
</antcall>
<replace dir="${build.web.dir}" includes="**"
token="@project-name@" value="${project.name}"/>
</target>
<target name="build-web-jar" depends="compile, prep">
<copy todir="${build.web-jar.dir}">
<!-- Copy all class files -->
<fileset dir="${java.compile.dir}"
includesfile="${java.web-jar.includes}"
excludesfile="${java.web-jar.excludes}" />
<!-- Copy all properties files required on classpath -->
<fileset dir="${config.resources.dir}"
includesfile="${config.web.files.includes}"
excludesfile="${config.web.files.excludes}" />
</copy>
<manifest file="${build.web-jar.dir}/META-INF/MANIFEST.MF"/>
</target>
<target name="build-ejb-jar" depends="compile, prep">
<!-- Copy all files required in EJB JAR -->
<copy todir="${build.ejb-jar.dir}">
<fileset dir="${java.compile.dir}"
includesfile="${java.ejb-jar.includes}" />
<fileset dir="${config.resources.dir}"
includesfile="${config.ejb-jar.files.includes}"
excludesfile="${config.ejb-jar.files.excludes}" />
</copy>
<manifest file="${build.ejb-jar.dir}/META-INF/MANIFEST.MF"/>
<antcall target="build-ejb-jar.${app-server}">
</antcall>
</target>
<target name="build-app-jar" depends="compile, prep">
<!-- Copy all files required in EJB JAR -->
<copy todir="${build.app-jar.dir}">
<fileset dir="${java.compile.dir}"
includesfile="${java.app-jar.includes}" />
<fileset dir="${config.resources.dir}"
includesfile="${config.app-jar.files.includes}"
excludesfile="${config.app-jar.files.excludes}" />
</copy>
<manifest file="${build.app-jar.dir}/META-INF/MANIFEST.MF"/>
</target>
<!-- Create the exploded EAR directory -->
<target name="build-ear" depends="build-war,build-app-jar,build-ejb-jar,prep-ear">
<!-- Copy exploded WAR -->
<copy todir="${build.app.dir}/${app.web.name}">
<fileset dir="${build.web.dir}"/>
</copy>
<jar destfile="${build.app.dir}/${app.ejb-jar.name}">
<fileset dir="${build.ejb-jar.dir}"/>
</jar>
<jar destfile="${build.app.dir}/${app.lib.dir}/${app.app-jar.name}">
<fileset dir="${build.app-jar.dir}"/>
</jar>
<antcall target="build-ear.${app-server}">
</antcall>
<replace dir="${build.app.dir}" includes="**"
token="@project-name@" value="${project.name}"/>
</target>
<!-- Create the exploded EAR directory -->
<target name="build-ear-file" depends="build-war,prep-ear">
<!-- Create WAR file -->
<jar destfile="${build.app.dir}/${app.web.name}">
<fileset dir="${build.web.dir}"/>
</jar>
<antcall target="build-ear.${app-server}">
</antcall>
<replace dir="${build.app.dir}" includes="**"
token="@project-name@" value="${project.name}"/>
<jar destfile="${dist.dir}/${app.name}">
<fileset dir="${build.app.dir}"/>
</jar>
</target>
<target name="build-war.tomcat">
<!-- Copy context files
<copy todir="${output.war.dir}">
<fileset dir="${config.dir}/tomcat" includes="META-INF/**"/>
</copy> -->
</target>
<target name="build-ejb-jar.tomcat">
</target>
<target name="build-ear.tomcat">
</target>
<target name="build-war.jboss">
</target>
<target name="build-ejb-jar.jboss">
</target>
<target name="build-ear.jboss">
</target>
<target name="build-war.weblogic">
</target>
<target name="build-ejb-jar.weblogic">
</target>
<target name="build-ear.weblogic">
</target>
<!-- Create a war file
<target name="war-file">
<zip destfile="${output.dir}/${war.file.name}">
<fileset dir="${output.war.dir}"/>
</zip>
</target>
<target name="web-jar-file">
<zip destfile="${output.dir}/${war.file.name}">
<fileset dir="${output.war.dir}"/>
</zip>
</target>
<target name="ejb-jar-file">
<zip destfile="${output.dir}/${war.file.name}">
<fileset dir="${output.war.dir}"/>
</zip>
</target>
<target name="ear-file">
<zip destfile="${output.dir}/${war.file.name}">
<fileset dir="${output.war.dir}"/>
</zip>
</target> -->
<!-- Deploy the exploded war to the application server -->
<target name="deploy" depends="build-ear">
<copy todir="${deploy.ear.path}">
<fileset dir="${build.app.dir}"/>
</copy>
</target>
<target name="dist.war" depends="build-war">
<jar destfile="${dist.war.path}">
<fileset dir="${build.web.dir}"/>
<fileset dir="${config.server.dir}"/>
</jar>
</target>
<target name="dist.ear" depends="build-ear">
<copy todir="${dist.ear.path}">
<fileset dir="${build.app.dir}"/>
</copy>
<copy todir="${dist.dir}">
<fileset dir="${config.server.dir}"/>
</copy>
</target>
<!-- target name="dist.war-file" depends="build-war-file">
<jar destfile="${dist.war.path}">
<fileset dir="${build.web.dir}"/>
<fileset dir="${config.server.dir}"/>
</jar>
</target -->
<target name="dist.ear-file" depends="build-ear-file">
<jar destfile="${dist.ear.path}">
<fileset dir="${build.app.dir}"/>
<fileset dir="${config.server.dir}"/>
</jar>
</target>
<target name="deploy.war" depends="dist.war">
<jar destfile="${deploy.war.path}">
<fileset dir="${dist.war.path}"/>
</jar>
</target>
<target name="deploy.ear" depends="dist.ear">
<copy todir="${deploy.dir}">
<fileset dir="${dist.dir}"/>
</copy>
</target>
<!-- Redeploy the application -->
<target name="redeploy">
<touch file="${build.app.dir}/META-INF/application.xml"/>
<touch file="${build.web.dir}/WEB-INF/web.xml"/>
<copy todir="${deploy.ear.path}">
<fileset file="${build.app.dir}/**"/>
</copy>
</target>
<!-- Redeploy the application -->
<target name="redeploy.ear" depends="deploy.ear">
<touch file="${build.app.dir}/META-INF/application.xml"/>
<touch file="${build.web.dir}/WEB-INF/web.xml"/>
<!-- jar destfile="${deploy.ear.path}" update="true">
<fileset dir="${build.app.dir}"/>
</jar -->
</target>
<target name="only-pages">
<copy todir="${deploy-temp.war.dir}">
<fileset dir="${web.src.dir}">
<include name="**/*"/>
<exclude name="**/*~"/>
</fileset>
</copy>
</target>
<!-- Create a source distribution -->
<target name="src-dist">
<zip destfile="${project.name}-src.zip">
<fileset dir="."
excludes=".git/,**/.svn/**,bin/**,build/**,dist/**,**/*~,${project.name}-src.zip" />
</zip>
</target>
</project>