This repository has been archived by the owner on Nov 10, 2017. It is now read-only.
forked from mareknovotny/jboss-seam
-
Notifications
You must be signed in to change notification settings - Fork 50
/
build.xml
542 lines (495 loc) · 19.5 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
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
<?xml version="1.0"?>
<project name="@projectName@" default="deploy" basedir=".">
<!-- Give user a chance to override without editing this file or typing -D -->
<property file="${basedir}/build.properties"/>
<property name="profile" value="dev"/>
<property file="build-${profile}.properties"/>
<!-- set global properties for this build -->
<property name="project.name" value="@projectName@"/>
<property name="project.ear" value="true"/>
<property name="richfaces.present" value="true"/>
<property name="dist.dir" value="dist"/>
<property name="src.model.dir" value="src/main"/>
<property name="src.action.dir" value="src/hot"/>
<property name="src.test.dir" value="src/test"/>
<property name="lib.dir" value="lib"/>
<property name="endorsed.dir" value="${lib.dir}/endorsed"/>
<property name="ear.dir" value="exploded-archives/${project.name}.ear"/>
<property name="exploded.archive.dir" value="${ear.dir}"/>
<property name="jar.dir" value="${ear.dir}/${project.name}_jar"/>
<property name="war.dir" value="${ear.dir}/${project.name}_war"/>
<property name="test.dir" value="test-build"/>
<property name="deploy.dir" value="${jboss.home}/standalone/deployments"/>
<property name="ear.deploy.dir" value="${deploy.dir}/${project.name}.ear"/>
<property name="jar.deploy.dir" value="${ear.deploy.dir}/${project.name}.jar"/>
<property name="war.deploy.dir" value="${ear.deploy.dir}/${project.name}.war"/>
<property name="packaged.archive" value="${dist.dir}/${project.name}.ear"/>
<!-- <property name="testng.jar" value="${basedir}/lib/testng.jar"/> -->
<property name="javac.debug" value="true"/>
<property name="javac.deprecation" value="false"/>
<property name="debug" value="false"/>
<!--Properties for validating configuration files -->
<property name="validate.resources.dir" value="${basedir}/exploded-archives"/>
<property name="schema.dir" value="${basedir}/exploded-archives/schemas"/>
<property name="src.schema.dir" value="${schema.dir}/org/jboss/seam"/>
<property name="schema.version" value="@schemaVersion@"/>
<fileset id="lib" dir="${lib.dir}">
<include name="*.jar"/>
</fileset>
<fileset id="testlib" dir="${lib.dir}/test">
<include name="*.jar"/>
</fileset>
<path id="build.classpath">
<fileset refid="lib"/>
<fileset refid="testlib"/>
</path>
<!-- Import GlassFish deployment targets -->
<import file="${basedir}/glassfish-build.xml"/>
<target name="init" description="Initialize the build">
<taskdef name="groovyc"
classname ="org.codehaus.groovy.ant.Groovyc"
classpath="${lib.dir}/groovy-all.jar"/>
<mkdir dir="${jar.dir}"/>
<mkdir dir="${ear.dir}"/>
<mkdir dir="${war.dir}"/>
<mkdir dir="${dist.dir}"/>
<condition property="is.debug" value="true">
<istrue value="${debug}"/>
</condition>
<property name="transactionManagerLookupClass" value="org.hibernate.transaction.JBossTransactionManagerLookup"/>
<property name="ejbJndiPattern" value="java:app/${project.name}.jar/#{ejbName}"/>
<property name="seamBootstrapsPu" value="false"/>
<property name="seamEmfRef" value="#{null}"/>
<property name="puJndiName" value="java:/${project.name}EntityManagerFactory"/>
<filterset id="persistence">
<filter token="transactionManagerLookupClass" value="${transactionManagerLookupClass}"/>
</filterset>
<filterset id="seam">
<filter token="ejbJndiPattern" value="${ejbJndiPattern}"/>
<filter token="seamBootstrapsPu" value="${seamBootstrapsPu}"/>
<filter token="seamEmfRef" value="${seamEmfRef}"/>
<filter token="puJndiName" value="${puJndiName}"/>
</filterset>
<filterset id="test">
<filter token="ejbJndiPattern" value="java:app/test/#{ejbName}"/>
<filter token="seamBootstrapsPu" value="${seamBootstrapsPu}"/>
<filter token="seamEmfRef" value="${seamEmfRef}"/>
<filter token="puJndiName" value="${puJndiName}"/>
</filterset>
<filterset id="profile">
<filter token="debug" value="${debug}"/>
</filterset>
<!-- if a .groovy file is in model or action, set groovy.present -->
<available property="groovy.present" value="true" file="" searchparents="true">
<filepath>
<fileset dir="${src.action.dir}">
<include name="**/*.groovy"/>
</fileset>
<fileset dir="${src.model.dir}">
<include name="**/*.groovy"/>
</fileset>
</filepath>
</available>
<condition property="groovy.test.present" value="true">
<or>
<isset property="groovy.present"/>
<available file="" searchparents="true">
<filepath>
<fileset dir="${src.test.dir}">
<include name="**/*.groovy"/>
</fileset>
</filepath>
</available>
</or>
</condition>
<!-- NOTE: Seam does not properly detect uncompiled groovy classes in an EAR -->
<condition property="groovy.dynamic" value="true">
<and>
<isset property="groovy.present"/>
<istrue value="${debug}"/>
</and>
</condition>
<condition property="groovy.static" value="true">
<and>
<isset property="groovy.present"/>
<isfalse value="${debug}"/>
</and>
</condition>
</target>
<target name="groovy.compile" if="groovy.static">
<groovyc classpathref="build.classpath"
destdir="${jar.dir}"
srcdir="${src.model.dir}">
</groovyc>
<path id="groovy.action.classpath">
<path refid="build.classpath"/>
<dirset dir="${jar.dir}"/>
</path>
<groovyc classpathref="groovy.action.classpath"
destdir="${jar.dir}"
srcdir="${src.action.dir}">
</groovyc>
</target>
<target name="groovy.copy" if="groovy.dynamic">
<copy todir="${jar.dir}">
<fileset dir="${src.action.dir}">
<include name="**/*.groovy"/>
</fileset>
</copy>
</target>
<target name="compile" depends="init,groovy.compile,groovy.copy"
description="Compile the Java source code"
unless="eclipse.running">
<javac classpathref="build.classpath"
destdir="${jar.dir}"
debug="${javac.debug}"
deprecation="${javac.deprecation}"
nowarn="on">
<src path="${src.model.dir}"/>
<src path="${src.action.dir}"/>
</javac>
</target>
<target name="copyclasses" depends="init"
description="Copy the classes that were compiled by eclipse"
if="eclipse.running">
<copy todir="${jar.dir}">
<fileset dir="classes/main">
<include name="**/*.class"/>
</fileset>
<fileset dir="classes/hot">
<include name="**/*.class"/>
</fileset>
</copy>
</target>
<target name="jar" depends="compile,copyclasses"
description="Build the JAR structure in a staging directory">
<copy todir="${jar.dir}">
<fileset dir="${src.model.dir}">
<include name="**/*.component.xml" />
</fileset>
<fileset dir="${basedir}/resources">
<include name="seam.properties"/>
<include name="*.drl"/>
<include name="META-INF/*.drl"/>
</fileset>
</copy>
<copy todir="${jar.dir}/META-INF">
<fileset dir="${basedir}/resources/META-INF">
<include name="ejb-jar.xml"/>
<include name="orm.xml"/>
</fileset>
</copy>
<copy tofile="${jar.dir}/META-INF/persistence.xml"
file="${basedir}/resources/META-INF/persistence-${profile}.xml">
<filterset refid="persistence"/>
</copy>
<copy tofile="${jar.dir}/import.sql"
file="${basedir}/resources/import-${profile}.sql"/>
</target>
<target name="war" depends="compile"
description="Build the WAR structure in a staging directory">
<copy todir="${war.dir}">
<fileset dir="${basedir}/view"/>
</copy>
<copy tofile="${war.dir}/WEB-INF/classes/components.properties"
file="${basedir}/resources/components-${profile}.properties">
<filterset refid="seam"/>
<filterset refid="profile"/>
</copy>
<copy todir="${war.dir}/WEB-INF">
<fileset dir="${basedir}/resources/WEB-INF">
<include name="*.*"/>
<include name="lib/*.*"/>
<exclude name="web.xml"/>
</fileset>
</copy>
<copy todir="${war.dir}/WEB-INF/lib">
<fileset dir="${lib.dir}">
<includesfile name="deployed-jars-war.list"/>
<exclude name="jboss-seam-gen.jar"/>
<exclude name="jboss-seam-debug.jar" unless="is.debug"/>
</fileset>
</copy>
<copy todir="${war.dir}/WEB-INF/classes">
<fileset dir="${basedir}/resources">
<include name="messages*.properties"/>
<include name="*.skin.properties" if="richfaces.present"/>
<include name="*_theme.properties"/>
<include name="**/*.ecss" if="richfaces.present"/>
</fileset>
<!-- move ECSS into classpath for now
loading from web context only works in JBoss AS 4 -->
<fileset dir="${basedir}/view">
<include name="**/*.ecss" if="richfaces.present"/>
</fileset>
</copy>
<copy todir="${war.dir}/WEB-INF"
file="${basedir}/resources/WEB-INF/web.xml">
<filterset refid="profile"/>
</copy>
</target>
<target name="ear" description="Build the EAR structure in a staging directory">
<copy todir="${ear.dir}">
<fileset dir="${basedir}/resources">
<include name="*jpdl.xml"/>
<include name="*hibernate.cfg.xml"/>
<include name="jbpm.cfg.xml"/>
</fileset>
<fileset dir="${lib.dir}">
<include name="jboss-seam.jar"/>
</fileset>
</copy>
<copy todir="${ear.dir}/lib">
<fileset dir="${lib.dir}">
<includesfile name="deployed-jars-ear.list"/>
<exclude name="icefaces-ahs.jar" if="icefaces.present"/>
</fileset>
</copy>
<copy todir="${ear.dir}/META-INF">
<fileset dir="${basedir}/resources/META-INF">
<include name="application.xml"/>
<include name="jboss-app.xml"/>
<include name="jboss-deployment-structure.xml"/>
</fileset>
</copy>
</target>
<target name="clear-profile-artifacts" depends="init"
description="Clear compiled cache of profile-specific artifacts in anticipation of a profile change">
<delete file="${jar.dir}/META-INF/persistence.xml"/>
<delete file="${jar.dir}/import.sql"/>
<delete file="${war.dir}/WEB-INF/classes/components.properties"/>
</target>
<target name="stage" depends="jar,war,ear"/>
<target name="archive" depends="clear-profile-artifacts,stage"
description="Package the archives">
<jar jarfile="${dist.dir}/${project.name}.jar" basedir="${jar.dir}"/>
<jar jarfile="${dist.dir}/${project.name}.war" basedir="${war.dir}"/>
<jar jarfile="${dist.dir}/${project.name}.ear">
<fileset dir="${ear.dir}">
<exclude name="${project.name}_jar/**"/>
<exclude name="${project.name}_war/**"/>
</fileset>
<fileset dir="${dist.dir}">
<include name="${project.name}.jar"/>
<include name="${project.name}.war"/>
</fileset>
</jar>
</target>
<target name="datasource">
<fail unless="jboss.home">jboss.home not set</fail>
<copy file="${basedir}/resources/${project.name}-${profile}-ds.xml"
tofile="${deploy.dir}/${project.name}-ds.xml"/>
</target>
<target name="explode" depends="prepare-explode,create-dodeploy"/>
<available file="${deploy.dir}/${project.name}.ear.deployed" property="deployed.file.exists"/>
<target name="prepare-explode" depends="stage,datasource"
description="Deploy the exploded archive">
<fail unless="jboss.home">jboss.home not set</fail>
<copy todir="${ear.deploy.dir}">
<fileset dir="${ear.dir}">
<include name="**/*"/>
<exclude name="${project.name}_jar/**"/>
<exclude name="${project.name}_war/**"/>
</fileset>
</copy>
<copy todir="${jar.deploy.dir}">
<fileset dir="${jar.dir}"/>
</copy>
<copy todir="${war.deploy.dir}">
<fileset dir="${war.dir}"/>
</copy>
</target>
<target name="create-dodeploy" unless="deployed.file.exists">
<touch file="${deploy.dir}/${project.name}.ear.dodeploy"/>
</target>
<target name="unexplode" description="Undeploy the exploded archive">
<delete file="${deploy.dir}/${project.name}.ear.deployed"/>
<delete failonerror="no">
<fileset dir="${ear.deploy.dir}">
<exclude name="**/*.jar"/>
</fileset>
</delete>
<delete file="${deploy.dir}/${project.name}-ds.xml" failonerror="no"/>
<delete dir="${ear.deploy.dir}" failonerror="no"/>
</target>
<target name="reexplode" depends="unexplode,clean,explode"
description="Undeploy the exploded archive, clean, then deploy the exploded archive"/>
<target name="check-deployed" description="Check to see if packaged archive is currently deployed">
<fail unless="jboss.home">jboss.home not set</fail>
<condition property="archive.deployed" value="true">
<available file="${ear.deploy.dir}" type="file"/>
</condition>
</target>
<target name="restart-exploded" unless="archive.deployed" description="Deploy exploded archive if not deployed as packaged archive">
<antcall target="explode"/>
<!--<touch file="${ear.deploy.dir}/META-INF/application.xml"/>-->
<touch file="${deploy.dir}/${project.name}.ear.dodeploy"/>
</target>
<target name="restart-deployed" if="archive.deployed" description="Deploy packaged archive if deployed as packaged archive">
<antcall target="deploy"/>
</target>
<target name="restart" depends="check-deployed,clear-profile-artifacts,restart-exploded,restart-deployed" description="Restart the exploded archive"/>
<target name="deploy" depends="archive,datasource" description="Deploy the packaged archive">
<fail unless="jboss.home">jboss.home not set</fail>
<copy todir="${deploy.dir}" file="${dist.dir}/${project.name}.ear"/>
</target>
<target name="undeploy" description="Undeploy the packaged archive">
<delete file="${deploy.dir}/${project.name}.ear"/>
<delete file="${deploy.dir}/${project.name}-ds.xml"/>
</target>
<target name="redeploy" depends="undeploy,clean,deploy"
description="Undeploy the packaged archive, clean, then deploy the packaged archive"/>
<target name="clean" description="Cleans up the staging directory">
<delete dir="${dist.dir}"/>
<delete dir="${basedir}/exploded-archives"/>
<delete dir="${src.schema.dir}" failonerror="no"/>
<delete dir="${basedir}/test-report"/>
<delete dir="${basedir}/test-output"/>
<delete failonerror="no" includeemptydirs="true">
<fileset dir="${test.dir}">
<exclude name="**/*.class" if="eclipse.running"/>
</fileset>
</delete>
</target>
<target name="compiletest" depends="groovy.compiletest" unless="eclipse.running" description="Compile the Java source code for the tests">
<mkdir dir="${test.dir}"/>
<javac classpathref="build.classpath"
destdir="${test.dir}"
debug="${javac.debug}"
deprecation="${javac.deprecation}"
nowarn="on">
<src path="${src.action.dir}"/>
<src path="${src.model.dir}"/>
<src path="${src.test.dir}"/>
</javac>
</target>
<target name="groovy.compiletest" if="groovy.test.present" description="Compile the Groovy source code for the tests">
<mkdir dir="${test.dir}"/>
<groovyc classpathref="build.classpath"
destdir="${test.dir}">
<src path="${src.action.dir}"/>
<src path="${src.model.dir}"/>
<src path="${src.test.dir}"/>
</groovyc>
</target>
<target name="copytestclasses" if="eclipse.running" description="Copy classes compiled by eclipse to the test dir">
<mkdir dir="${test.dir}"/>
<copy todir="${test.dir}">
<fileset dir="classes/main">
<include name="**/*.class"/>
</fileset>
</copy>
<copy todir="${test.dir}">
<fileset dir="classes/hot">
<include name="**/*.class"/>
</fileset>
</copy>
<copy todir="${test.dir}">
<fileset dir="classes/test">
<include name="**/*.class"/>
</fileset>
</copy>
</target>
<target name="buildtest" depends="init,compiletest,copytestclasses" description="Build the tests">
<copy todir="${test.dir}">
<fileset dir="${basedir}/resources">
<exclude name="META-INF/persistence*.xml"/>
<exclude name="import*.sql"/>
<exclude name="${project.name}-*-ds.xml"/>
<exclude name="components-*.properties"/>
<exclude name="WEB-INF/web-*.xml"/>
<exclude name="WEB-INF/web.xml"/>
</fileset>
<fileset dir="${basedir}/view"/>
</copy>
<copy tofile="${test.dir}/META-INF/persistence.xml"
file="${basedir}/resources/META-INF/persistence-test.xml"/>
<copy tofile="${test.dir}/import.sql"
file="${basedir}/resources/import-test.sql"/>
<copy tofile="${test.dir}/components.properties"
file="${basedir}/resources/components-test.properties">
<filterset refid="test"/>
</copy>
<copy tofile="${test.dir}/WEB-INF/ejb-jar.xml"
file="${basedir}/resources/META-INF/ejb-jar.xml"/>
<copy tofile="${test.dir}/components.properties"
file="${basedir}/resources/components-test.properties"/>
<copy tofile="${test.dir}/WEB-INF/web.xml"
file="${basedir}/resources/WEB-INF/web-test.xml"/>
<copy todir="${test.dir}" flatten="true">
<fileset dir="${src.test.dir}">
<include name="**/*Test.xml"/>
</fileset>
</copy>
</target>
<target name="test" depends="buildtest" description="Run the tests">
<!-- <fail message="Test target is currently not supported"/> -->
<fail message="Cannot run tests because path to project contains spaces.">
<condition>
<contains string="${basedir}" substring=" "/>
</condition>
</fail>
<!-- <condition property="incompatible.jdk" value="true">
<and>
<equals arg1="${ant.java.version}" arg2="1.6"/>
<not><available classname="javax.xml.bind.JAXB"/></not>
</and>
</condition>
<fail if="incompatible.jdk">You are using an incompatible JDK 6. Please use Sun JDK 6 Update 4 (1.6.0_04) or newer or use Open JDK 6.</fail>
-->
<!--<taskdef resource="testngtasks" classpath="${testng.jar}"/>-->
<path id="test.path">
<path path="${test.dir}"/>
<fileset dir="${lib.dir}/test">
<include name="*.jar"/>
</fileset>
<path refid="build.classpath"/>
</path>
<mkdir dir="${basedir}/test-report"/>
<junit printsummary="yes">
<!--outputdir="${basedir}/test-report">-->
<!--<jvmarg line="-Dsun.lang.ClassLoader.allowArraySyntax=true"/>-->
<formatter type="xml"/>
<classpath refid="test.path"/>
<batchtest todir="${basedir}/test-report">
<fileset dir="${test.dir}">
<include name="**/*Test.class"/>
</fileset>
</batchtest>
</junit>
<junitreport todir="${basedir}/test-report">
<fileset dir="${basedir}/test-report"/>
<report todir="${basedir}/test-report"/>
</junitreport>
</target>
<target name="javadoc" depends="compile">
<mkdir dir="${dist.dir}/apidoc"/>
<javadoc classpathref="build.classpath" destdir="${dist.dir}/apidoc" use="true" protected="true" version="true" windowtitle="${project.name} API Documentation" doctitle="${project.name} API Documentation" link="http://java.sun.com/j2se/5.0/docs/api">
<packageset dir="${src.action.dir}" defaultexcludes="yes">
<include name="*/**"/>
</packageset>
<packageset dir="${src.model.dir}" defaultexcludes="yes">
<include name="*/**"/>
</packageset>
</javadoc>
</target>
<!-- deprecated -->
<target name="validateConfiguration" depends="validate"/>
<target name="validate" depends="stage" description="Validate the XML configuration files">
<mkdir dir="${schema.dir}"/>
<unjar src="${lib.dir}/jboss-seam.jar" dest="${schema.dir}">
<patternset>
<include name="org/jboss/seam/*.xsd"/>
<include name="org/jboss/seam/*.dtd"/>
</patternset>
</unjar>
<ant antfile="validate.xml" target="validateConfiguration"/>
</target>
<target name="purge" depends="undeploy" description="Clean out JBoss AS temporary deployment files">
<delete dir="${deploy.dir}/${project.name}.ear.undeployed"/>
<delete dir="${deploy.dir}/${project.name}.ear.failed"/>
<delete dir="${deploy.dir}/${project.name}-ds.xml.undeployed"/>
<delete dir="${deploy.dir}/${project.name}-ds.xml.failed"/>
<delete dir="${deploy.dir}/${project.name}.ear"/>
</target>
</project>