This repository has been archived by the owner on Jan 24, 2023. It is now read-only.
forked from seam2/jboss-seam
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.xml
304 lines (270 loc) · 12.3 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
<?xml version="1.0"?>
<project name="booking" basedir="." default="package"
xmlns:artifact="antlib:org.apache.maven.artifact.ant"
xmlns:rsel="antlib:org.apache.tools.ant.types.resources.selectors">
<echo>${ant.version}</echo>
<!-- Check that we are using Ant 1.8.0 and higher.
Not using <antversion> as it wasn't available until 1.7.0.
-->
<condition property="compatible.ant">
<or>
<contains string="${ant.version}" substring="1.8"/>
<contains string="${ant.version}" substring="1.9"/>
</or>
</condition>
<fail unless="compatible.ant">You are using ${ant.version}. You must use Ant 1.8.0 or higher to build Seam examples.</fail>
<!-- Properties -->
<property environment="env"/>
<property name="project.name" value="booking"/>
<property name="root.dir" value="../.."/>
<property name="ear.module.dir" value="${basedir}/${project.name}-ear"/>
<property name="ejb.module.dir" value="${basedir}/${project.name}-ejb"/>
<property name="web.module.dir" value="${basedir}/${project.name}-web"/>
<property name="target.dir" value="target"/>
<property name="target.classes.dir" value="${target.dir}/classes"/>
<property name="target.test-classes.dir" value="${target.dir}/test-classes"/>
<property name="target.web.dir" value="${target.dir}/webapp"/>
<property name="target.ear.dir" value="${target.dir}/${project.name}-ear"/>
<property name="target.test.classes.dir" value="${target.dir}/test-classes"/>
<property name="target.test.results.dir" value="${target.dir}/test-results"/>
<property name="target.test.reports.dir" value="${target.dir}/test-reports"/>
<property name="src.main.java.dir" value="src/main/java"/>
<property name="src.test.java.dir" value="src/test/java"/>
<property name="src.main.webapp.dir" value="src/main/webapp"/>
<property name="src.main.resources.dir" value="src/main/resources"/>
<property name="src.test.resources.dir" value="src/test/resources"/>
<property name="src.main.application.dir" value="src/main/application"/>
<property name="javac.debug" value="true"/>
<property name="javac.deprecation" value="false"/>
<property name="debug" value="false"/>
<property name="version.jbossas7" value="7.1.1.Final"/>
<property name="jndiPattern" value="java:app/${project.name}-ejb/#{ejbName}"/>
<property name="distributable" value="false"/>
<!-- Maven ant tasks plugin setting -->
<path id="build.lib.classpath">
<fileset dir="${root.dir}/build/lib">
<include name="**/*.jar"/>
</fileset>
</path>
<typedef resource="org/apache/maven/artifact/ant/antlib.xml"
uri="antlib:org.apache.maven.artifact.ant"
classpathref="build.lib.classpath"/>
<!-- POMs -->
<artifact:pom id="ejb-pom" file="${ejb.module.dir}/pom.xml"/>
<artifact:pom id="web-pom" file="${web.module.dir}/pom.xml"/>
<artifact:pom id="ear-pom" file="${ear.module.dir}/pom.xml"/>
<artifact:pom id="ejb-test-pom" file="${ejb.module.dir}/pom.xml">
<profile id="arq-jbossas-7-managed"/>
</artifact:pom>
<!-- Root targets -->
<target name="clean"
depends="clean-ejb,clean-web,clean-ear"/>
<target name="compile"
depends="compile-ejb,compile-web"/>
<target name="package"
depends="package-ejb,package-web,package-ear"/>
<target name="install"
depends="install-ejb,install-web,install-ear"/>
<!-- Module specific targets -->
<!-- Clean -->
<target name="clean-ejb">
<delete dir="${ejb.module.dir}/${target.dir}"/>
</target>
<target name="clean-web">
<delete dir="${web.module.dir}/${target.dir}"/>
</target>
<target name="clean-ear">
<delete dir="${ear.module.dir}/${target.dir}"/>
</target>
<!-- Compile -->
<target name="compile-ejb">
<artifact:dependencies pathId="ejb.module.classpath" pomRefId="ejb-pom"/>
<mkdir dir="${ejb.module.dir}/${target.classes.dir}"/>
<javac source="1.6" target="1.6" debug="${javac.debug}"
deprecation="${javac.deprecation}"
nowarn="on"
includeantruntime="false"
destdir="${ejb.module.dir}/${target.classes.dir}">
<src path="${ejb.module.dir}/${src.main.java.dir}"/>
<classpath refid="ejb.module.classpath"/>
<compilerarg value="-Xlint"/>
</javac>
</target>
<target name="compile-web">
<artifact:dependencies pathId="web.module.classpath"
pomRefId="web-pom" useScope="runtime"/>
<mkdir dir="${web.module.dir}/${target.dir}"/>
<mkdir dir="${web.module.dir}/${src.main.java.dir}"/>
<mkdir dir="${web.module.dir}/${target.classes.dir}"/>
<javac source="1.6" target="1.6" debug="${javac.debug}"
deprecation="${javac.deprecation}"
nowarn="on"
includeantruntime="false">
<src path="${web.module.dir}/${src.main.java.dir}"/>
<classpath refid="web.module.classpath"/>
<compilerarg value="-Xlint"/>
</javac>
</target>
<!-- Package -->
<target name="package-ejb" depends="compile-ejb"
description="Package the compiled source code">
<jar destfile="${ejb.module.dir}/${target.dir}/${project.name}-ejb.jar"
basedir="${ejb.module.dir}/${target.classes.dir}">
<metainf dir="${ejb.module.dir}/${src.main.resources.dir}/META-INF">
<include name="ejb-jar.xml"/>
<include name="persistence.xml"/>
</metainf>
<fileset dir="${ejb.module.dir}/${src.main.resources.dir}">
<include name="import.sql"/>
<include name="seam.properties"/>
</fileset>
</jar>
</target>
<target name="package-web" depends="compile-web">
<artifact:dependencies filesetId="web.module.fileset"
pomRefId="web-pom" useScope="runtime"/>
<mkdir dir="${web.module.dir}/${target.web.dir}"/>
<copy todir="${web.module.dir}/${target.web.dir}">
<fileset dir="${web.module.dir}/${src.main.webapp.dir}"/>
<filterset begintoken="$${" endtoken="}">
<filter token="jndiPattern" value="${jndiPattern}"/>
<filter token="distributable" value="${distributable}"/>
</filterset>
</copy>
<copy todir="${web.module.dir}/${target.web.dir}/WEB-INF/lib">
<fileset refid="web.module.fileset"/>
<!-- This mapper strips off all leading directory information -->
<mapper type="flatten"/>
</copy>
<copy todir="${web.module.dir}/${target.classes.dir}">
<fileset dir="${web.module.dir}/${src.main.resources.dir}">
<include name="messages.properties"/>
</fileset>
</copy>
<war destfile="${web.module.dir}/${target.dir}/${project.name}-web.war"
webxml="${web.module.dir}/${target.web.dir}/WEB-INF/web.xml">
<fileset dir="${web.module.dir}/${target.web.dir}">
<exclude name="/WEB-INF/web.xml"/>
</fileset>
<classes dir="${web.module.dir}/${target.classes.dir}"/>
</war>
</target>
<target name="package-ear" depends="install-web,install-ejb">
<artifact:dependencies pathId="ear.module.classpath"
filesetId="ear.module.fileset" pomRefId="ear-pom"/>
<artifact:dependencies filesetId="ejb.module.fileset" useScope="runtime"
pomRefId="ejb-pom"/>
<copy todir="${ear.module.dir}/${target.ear.dir}">
<fileset refid="ear.module.fileset"/>
<mapper>
<chainedmapper>
<mapper type="flatten"/>
<mapper type="glob" from="jboss-seam*.jar" to="jboss-seam.jar"/>
</chainedmapper>
<chainedmapper>
<mapper type="flatten"/>
<mapper type="glob" from="${project.name}-ejb*.jar" to="${project.name}-ejb.jar"/>
</chainedmapper>
<chainedmapper>
<mapper type="flatten"/>
<mapper type="glob" from="${project.name}-web*.war" to="${project.name}-web.war"/>
</chainedmapper>
</mapper>
</copy>
<artifact:dependencies pathId="lib.classpath" filesetId="lib.fileset">
<dependency groupId="org.jboss.el" artifactId="jboss-el" version="1.0_02.CR6">
<exclusion groupId="javax.el" artifactId="el-api"/>
</dependency>
</artifact:dependencies>
<copy todir="${ear.module.dir}/${target.ear.dir}/lib">
<fileset refid="lib.fileset"/>
<restrict>
<fileset refid="ejb.module.fileset"/>
<rsel:not>
<rsel:name name="**/jboss-seam*.jar"/>
</rsel:not>
</restrict>
<chainedmapper>
<flattenmapper/>
<mapper type="glob" from="jboss-el*.jar" to="jboss-el.jar"/>
</chainedmapper>
</copy>
<ear destfile="${ear.module.dir}/${target.dir}/seam-${project.name}.ear"
appxml="${ear.module.dir}/${src.main.resources.dir}/application-for-ant-only.xml">
<metainf dir="${ear.module.dir}/${src.main.application.dir}/META-INF">
<include name="*.xml"/>
</metainf>
<fileset dir="${ear.module.dir}/${target.ear.dir}">
<include name="**/*"/>
</fileset>
</ear>
</target>
<!-- Install -->
<target name="install-ejb" depends="package-ejb">
<artifact:install file="${ejb.module.dir}/${target.dir}/${project.name}-ejb.jar">
<pom refid="ejb-pom"/>
</artifact:install>
</target>
<target name="install-web" depends="package-web">
<artifact:install file="${web.module.dir}/${target.dir}/${project.name}-web.war">
<pom refid="web-pom"/>
</artifact:install>
</target>
<target name="install-ear" depends="package-ear">
<artifact:install file="${ear.module.dir}/${target.dir}/seam-${project.name}.ear">
<pom refid="ear-pom"/>
</artifact:install>
</target>
<!-- Tests -->
<target name="compile-test" depends="compile-ejb">
<artifact:dependencies pathId="test.dependencies" pomRefId="ejb-test-pom" />
<path id="combined.project.classpath">
<path refid="test.dependencies" />
<pathelement location="${ejb.module.dir}/${target.classes.dir}"/>
</path>
<copy todir="${ejb.module.dir}/${target.test.classes.dir}" filtering="true">
<filterset begintoken="${" endtoken="}">
<filter token="jacoco.agent" value="" />
<filter token="jndiPattern" value="java:app/seam-${project.name}/#{ejbName}" />
<filter token="distributable" value="${distributable}" />
</filterset>
<fileset dir="${ejb.module.dir}/${src.test.resources.dir}" />
<fileset dir="${ejb.module.dir}/${src.main.resources.dir}" />
</copy>
<mkdir dir="${ejb.module.dir}/${target.test.classes.dir}"/>
<javac source="1.6" target="1.6" debug="${javac.debug}"
deprecation="${javac.deprecation}"
destdir="${ejb.module.dir}/${target.test.classes.dir}"
nowarn="on"
includeantruntime="false">
<compilerarg value="-Xlint"/>
<src path="${ejb.module.dir}/${src.test.java.dir}"/>
<classpath refid="combined.project.classpath"/>
</javac>
</target>
<target name="test" depends="compile-test">
<path id="combined.test.project.classpath">
<path refid="combined.project.classpath"/>
<pathelement location="${ejb.module.dir}/${target.test.classes.dir}"/>
</path>
<mkdir dir="${ejb.module.dir}/${target.test.classes.dir}"/>
<mkdir dir="${ejb.module.dir}/${target.test.results.dir}"/>
<mkdir dir="${ejb.module.dir}/${target.test.reports.dir}"/>
<junit printsummary="yes" haltonfailure="no" fork="yes" dir="${ejb.module.dir}">
<formatter type="xml"/>
<classpath refid="combined.test.project.classpath"/>
<batchtest fork="true" todir="${ejb.module.dir}/${target.test.results.dir}">
<fileset dir="${ejb.module.dir}/${target.test.classes.dir}">
<exclude name="**/Deployments.class"/>
<include name="**/*Test.class"/>
</fileset>
</batchtest>
</junit>
<junitreport todir="${ejb.module.dir}/${target.test.reports.dir}">
<fileset dir="${ejb.module.dir}/${target.test.results.dir}">
<include name="TEST-*.xml" />
</fileset>
<report todir="${ejb.module.dir}/${target.test.reports.dir}" />
</junitreport>
</target>
</project>