-
Notifications
You must be signed in to change notification settings - Fork 4
/
build.xml
305 lines (238 loc) · 10.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
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns:if="ant:if"
xmlns:unless="ant:unless"
name="javaee7-web-distribution"
basedir="."
default="install">
<!--
javaee7-web
target <= work directory to test archetype > ${workdir}
javaee7-web-min-test-site
javaee7-web-min
pom.xml
distribution
pom.xml <= *1
target
generated-sources/archetype <= output of archetype:create-from-project
and files of new archetype > ${newarchres}
pom.xml <= copy overwrite with *1
src/main/resources
META-INF
archetype-resources <= fillerd javaee7-web-min files > ${archresdir}
pom.xml
src
testscript
tools
-->
<property environment="env" />
<property name="newVersion" value="1.1" />
<input addproperty="artifactId"
validargs="javaee7-web-min,javaee7-web-tips"
defaultvalue="javaee7-web-min" />
<property name="workdir" value="${basedir}/${artifactId}/target" />
<property name="archresdir"
value="${artifactId}/target/generated-sources/archetype/src/main/resources/archetype-resources" />
<property name="newarchdir" value="${basedir}/${artifactId}/target/generated-sources/archetype" />
<condition property="test.glassfish">
<equals arg1="${artifactId}" arg2="javaee7-web-min" />
</condition>
<property name="test.site" value="false" />
<property name="test.glassfish" value="false" />
<property name="test.was-liberty" value="true" />
<property name="test.wildfly" value="false" />
<condition property="mvn.cmd" value="${env.MAVEN_HOME}/bin/mvn.cmd" else="/usr/local/bin/mvn">
<os family="windows" />
</condition>
<property name="db.port.site" value="3307"/>
<property name="db.port.was-liberty" value="3308"/>
<target name="install">
<property name="mvn.phase" value="install" />
<property name="mvn.performRelease" value="false" />
<antcall target="process-all" />
</target>
<target name="deploy">
<property name="mvn.phase" value="deploy" />
<property name="mvn.performRelease" value="true" />
<antcall target="process-all" />
</target>
<target name="process-all">
<antcall target="01_create-from-archetype" />
<antcall target="02_modify-archetype-resource" />
<antcall target="03_process-archetype" />
<antcall target="04_acceptance-test" />
</target>
<target name="01_create-from-archetype">
<echo message="${basedir}/${archresdir}>mvn clean archetype:create-from-project"/>
<exec executable="${mvn.cmd}" dir="${basedir}/${artifactId}" failonerror="true">
<env key="JAVA_HOME" value="${java.home}" />
<arg value="clean" />
<arg value="archetype:create-from-project" />
<arg value="-Darchetype.filteredExtentions=java,xml,txt,groovy,cs,mdo,aj,jsp,gsp,vm,html,properties,.classpath,.project,launch,component" />
</exec>
</target>
<target name="02_modify-archetype-resource">
<delete dir="${archresdir}/evidence" verbose="true"/>
<delete dir="${archresdir}/distribution" verbose="true"/>
<delete dir="${archresdir}/tools/derby/target" verbose="true"/>
<delete dir="${archresdir}/tools/mysql/data" verbose="true"/>
<delete dir="${archresdir}/tools/mysql/target" verbose="true"/>
<delete verbose="true">
<fileset dir="${archresdir}" includes="**/.DS_Store"/>
</delete>
<property name="settings" value="${archresdir}/.settings" />
<move todir="${settings}" includeemptydirs="false">
<fileset dir="${settings}" includes="*.launch" />
<globmapper from="${artifactId}*.launch" to="__artifactId__*.launch" />
</move>
<replace dir="${archresdir}" token="<?xml version="${version}"" value="<?xml version="1.0"" summary="true">
<include name="**/*.xml"/>
<include name="**/*.xhtml"/>
</replace>
<copy file="${basedir}/${artifactId}/distribution/pom.xml" todir="${newarchdir}" overwrite="true" />
</target>
<target name="03_process-archetype">
<echo message="${newarchdir}>mvn version:set -DnewVewsion=${newVersion}"/>
<exec executable="${mvn.cmd}" dir="${newarchdir}" failonerror="true">
<env key="JAVA_HOME" value="${java.home}" />
<arg value="versions:set" />
<arg value="-DnewVersion=${newVersion}" />
<arg value="-e"/>
</exec>
<condition property="mvn.phase" value="install">
<not>
<isset property="mvn.phase" />
</not>
</condition>
<echo message="${newarchdir}>mvn clean ${mvn.phase} -DperformReleease=${mvn.performRelease}"/>
<exec executable="${mvn.cmd}" dir="${newarchdir}" failonerror="true">
<env key="JAVA_HOME" value="${java.home}" />
<arg value="clean" />
<arg value="${mvn.phase}" />
<arg value="-DperformRelease=${mvn.performRelease}" />
<arg value="-e"/>
</exec>
</target>
<target name="04_acceptance-test">
<antcall target="test-site" />
<antcall target="test-glassfish" />
<antcall target="test-was-liberty" />
<antcall target="test-wildfly" />
</target>
<target name="archetype-generate">
<exec executable="${mvn.cmd}" dir="${workdir}" failonerror="true">
<env key="JAVA_HOME" value="${java.home}" />
<arg value="-DarchetypeGroupId=org.sitoolkit.ad.archetype" />
<arg value="-DarchetypeArtifactId=${artifactId}" />
<arg value="-DarchetypeVersion=${newVersion}" />
<arg value="-DgroupId=a.b.c" />
<arg value="-DartifactId=${testArtifactId}" />
<arg value="-Darchetype.interactive=false" />
<arg value="-DarchetypeCatalog=local" />
<arg value="-B" />
<arg value="archetype:generate" />
</exec>
</target>
<target name="test-site" if="${test.site}">
<property name="testArtifactId" value="${artifactId}-test-site" />
<antcall target="archetype-generate" />
<exec executable="${mvn.cmd}" dir="${workdir}/${testArtifactId}" resultproperty="mvn.site.exitcode">
<env key="JAVA_HOME" value="${java.home}" />
<arg value="-Dfile.encoding=UTF-8" />
<arg value="-Ddb.port=${db.port.site}" />
<arg value="-Dmpir.skip=true" />
<arg value="-Pmysql,db-migrate" />
<arg value="site" />
<arg value="-e"/>
</exec>
<exec executable="${mvn.cmd}" dir="${workdir}/${testArtifactId}">
<env key="JAVA_HOME" value="${java.home}" />
<arg value="-Ddb.port=${db.port.site}" />
<arg value="-Dmysql=stop" />
</exec>
<fail message="${workdir}/${testArtifactId}>mvn site failed!">
<condition>
<not>
<equals arg1="${mvn.site.exitcode}" arg2="0"/>
</not>
</condition>
</fail>
</target>
<target name="test-glassfish" if="${test.glassfish}">
<property name="testArtifactId" value="${artifactId}-test-glassfish" />
<antcall target="archetype-generate" />
<exec executable="${mvn.cmd}" dir="${workdir}/${testArtifactId}" failonerror="true">
<env key="JAVA_HOME" value="${java.home}" />
<arg value="verify" />
<arg value="-Pderby,db-migrate,embedded-glassfish,it" />
<arg value="-Devidence.open=false" />
<arg value="-Dfile.encoding=UTF-8" />
<arg value="-Ddb.port=1528" />
<arg value="-Das.port=8091" />
<arg value="-e"/>
</exec>
</target>
<target name="test-was-liberty" if="${test.was-liberty}">
<property name="testArtifactId" value="${artifactId}-test-was-liberty" />
<antcall target="archetype-generate" />
<exec executable="${mvn.cmd}" dir="${workdir}/${testArtifactId}" resultproperty="mvn.verify.exitcode">
<env key="JAVA_HOME" value="${java.home}" />
<arg value="verify" />
<arg value="-Pmysql,db-migrate,was-liberty,it,it-parallel" />
<arg value="-Devidence.open=false" />
<arg value="-Dfile.encoding=UTF-8" />
<arg value="-Ddb.port=${db.port.was-liberty}" />
<arg value="-Das.port=8092" />
<arg value="-e"/>
</exec>
<exec executable="${mvn.cmd}" dir="${workdir}/${testArtifactId}">
<env key="JAVA_HOME" value="${java.home}" />
<arg value="-Ddb.port=${db.port.was-liberty}" />
<arg value="-Dmysql=stop" />
</exec>
<fail message="${workdir}/${testArtifactId}>mvn verify failed!">
<condition>
<not>
<equals arg1="${mvn.verify.exitcode}" arg2="0"/>
</not>
</condition>
</fail>
</target>
<target name="test-wildfly" if="${test.wildfly}">
<property name="testArtifactId" value="${artifactId}-test-wildfly" />
<antcall target="archetype-generate" />
<exec executable="${mvn.cmd}" dir="${workdir}/${testArtifactId}" failonerror="true">
<env key="JAVA_HOME" value="${java.home}" />
<arg value="verify" />
<arg value="-Pderby,db-migrate,wildfly,it" />
<arg value="-Dmaven.test.skip=false" />
<arg value="-Devidence.open=false" />
<arg value="-Dfile.encoding=UTF-8" />
<arg value="-Ddb.port=1530" />
<arg value="-Das.port=8093" />
<arg value="-e"/>
</exec>
</target>
<target name="set-version">
<exec executable="${mvn.cmd}" dir="${basedir}" failonerror="true">
<env key="JAVA_HOME" value="${java.home}" />
<arg value="-DnewVersion=${newVersion}" />
<arg value="clean" />
<arg value="versions:set" />
<arg value="install" />
</exec>
<!-- このコマンドで javaee7-web-min、javaee7-web-tipsのparent/versionが上がるはずですが、上がりません。
原因は不明です。pom.xmlを手で書き換えてください。-->
<exec executable="${mvn.cmd}" dir="${basedir}/javaee7-web-min" failonerror="true">
<env key="JAVA_HOME" value="${java.home}" />
<arg value="-DallowSnapshots=true" />
<arg value="-DparentVersion=${newVersion}" />
<arg value="versions:update-parent" />
</exec>
<exec executable="${mvn.cmd}" dir="${basedir}/javaee7-web-tips" failonerror="true">
<env key="JAVA_HOME" value="${java.home}" />
<arg value="-DallowSnanshots=true" />
<arg value="-DparentVersion=${newVersion}" />
<arg value="versions:update-parent" />
</exec>
</target>
</project>