-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.xml
executable file
·318 lines (247 loc) · 9.4 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
<project name="antweb" default="compile" basedir=".">
<property file="build.properties"/>
<property name="app.name" value="antweb"/>
<property name="app.version" value="3.0"/>
<property name="build.home" value="build"/>
<property name="dist.home" value="dist"/>
<property name="antweb.home" value="/usr/local/antweb"/>
<property name="deploy.home" value="${antweb.home}"/>
<property name="doc.home" value="${deploy.home}/docs/javadocs"/>
<property name="lib.home" value="WEB-INF/lib"/>
<!-- property name="workingdir" value="${workingdir}"/ -->
<property name="catalina.home" value="/usr/local/tomcat"/>
<property name="add.home" value="etc/add"/>
<property name="compile.debug" value="true"/>
<property name="compile.deprecation" value="true"/>
<property name="compile.optimize" value="true"/>
<!--import file="${catalina.home}/bin/catalina-tasks.xml"/ -->
<path id="compile.classpath">
<!-- Include all JAR files that will be included in /WEB-INF/lib -->
<!-- *** CUSTOMIZE HERE AS REQUIRED BY YOUR APPLICATION *** -->
<!--
<pathelement location="${foo.jar}"/>
-->
<pathelement location="${lib.home}" />
<fileset dir="${lib.home}">
<include name="*.jar"/>
</fileset>
<!--pathelement location="${java.home/lib/jars/jtds-0.5.1.jar}"/ --> <!-- was 0.3.2 -->
<!--
zonaGeek.jpeg.JpegShortcuts class not found can break compilcation after build directory is deleted.
It does not seem to compile properly out of Jpeg.java. Copy from server to build directory is a
janky solution.
scp [email protected]:/data/antweb/WEB-INF/classes/com/zonageek/jpeg/JpegShortcuts.class build/WEB-INF/classes/com/zonageek/jpeg/
-->
<!-- Include all elements that Tomcat exposes to applications -->
<!-- pathelement location="${catalina.home}/common/classes"/ -->
<fileset dir="${catalina.home}/lib">
<include name="*.jar"/>
</fileset>
</path>
<target name="all" depends="clean,compile,test"
description="Clean build and dist, then compile and test"/>
<target name="clean"
description="Delete old build and dist directories">
<delete dir="${build.home}"/>
<delete dir="${dist.home}"/>
</target>
<target name="cleanAllX" depends="deleteDeployment" if="{$app.name}==antweb"
description="Delete old build and dist directories">
<echo message="app.name: ${app.name}"/>
</target>
<target name="deleteDeployment">
<!-- delete dir="${deploy.home}"/ -->
</target>
<target name="compile" depends="prepare"
description="Compile Java sources">
<mkdir dir="${build.home}/WEB-INF/classes"/>
<javac srcdir="src"
destdir="${build.home}/WEB-INF/classes"
debug="${compile.debug}"
deprecation="${compile.deprecation}"
includeantruntime="false"
optimize="${compile.optimize}">
<classpath refid="compile.classpath"/>
</javac>
<javac srcdir="test"
destdir="${build.home}/WEB-INF/classes"
debug="${compile.debug}"
deprecation="${compile.deprecation}"
includeantruntime="false"
optimize="${compile.optimize}">
<classpath refid="compile.classpath"/>
</javac>
<copy todir="${build.home}/WEB-INF">
<fileset dir="WEB-INF" includes="**/*.xml"/>
<fileset dir="WEB-INF" includes="**/*.tld"/>
<fileset dir="WEB-INF" includes="**/ApplicationResources.properties" followsymlinks="true"/>
<fileset dir="WEB-INF" includes="**/AntwebResources.properties"/>
<fileset dir="WEB-INF" includes="**/platform.properties"/>
<fileset dir="WEB-INF" includes="**/log4j.properties" />
</copy>
<copy todir="${build.home}/WEB-INF/lib">
<fileset dir="WEB-INF/lib" includes="**/*.jar"/>
<fileset dir="WEB-INF" includes="**/*.dtd"/>
</copy>
<copy todir="${build.home}/doc">
<fileset dir="doc" includes="release.txt"/>
</copy>
</target>
<!--
Added by Mark. Does not work yet.
To successfully compile jsps from ant you must set this environment property:
export ANT_OPTS=-Dorg.apache.jasper.compiler.Parser.STRICT_QUOTE_ESCAPING=false
-->
<target name="jspCompile" depends="clean, compile">
<!--
<taskdef classname="org.apache.jasper.JspC" name="jasper2" >
<classpath id="jspc.classpath">
<pathelement location="${java.home}/../lib/tools.jar"/>
<fileset dir="${catalina.home}/bin">
<include name="*.jar"/>
</fileset>
<fileset dir="${catalina.home}/lib">
<include name="*.jar"/>
</fileset>
</classpath>
</taskdef>
-->
<!-- target name="jspc" -->
<jasper
validateXml="false"
uriroot="${build.home}"
webXmlFragment="${build.home}/WEB-INF/generated_web.xml"
outputDir="${build.home}/WEB-INF/src" />
</target>
<!-- added by mark. Does not work yet. -->
<target name="reload" depends="compile"
description="Reload application on servlet container">
<reload url="${manager.url}"
username="${manager.username}"
password="${manager.password}"
path="${app.path}"/>
</target>
<target name="deploy" depends="compile"
description="Deploy application to servlet container">
<!-- Copy the contents of the build directory -->
<mkdir dir="${deploy.home}"/>
<copy todir="${deploy.home}" failonerror="false">
<fileset dir="${build.home}" followsymlinks="false"/>
</copy>
<mkdir dir="${deploy.home}/WEB-INF/lib"/>
</target>
<target name="updatecode" depends="compile"
description="Deploy application to servlet container">
<!-- Copy the contents of the build directory -->
<mkdir dir="${deploy.home}/WEB-INF"/>
<copy todir="${deploy.home}/WEB-INF">
<fileset dir="${build.home}/WEB-INF"/>
</copy>
<mkdir dir="${deploy.home}/WEB-INF/lib"/>
</target>
<target name="dist" depends="deploy,javadoc"
description="Create binary distribution">
<!-- Copy documentation subdirectory -->
<copy todir="${dist.home}/docs">
<fileset dir="docs"/>
</copy>
<!-- Create application JAR file -->
<jar jarfile="${dist.home}/${app.name}.war"
basedir="${deploy.home}"/>
<!-- Copy additional files to ${dist.home} as necessary -->
</target>
<target name="javadoc" depends="compile"
description="Create Javadoc API documentation">
<mkdir dir="${doc.home}/docs/api"/>
<javadoc sourcepath="src"
destdir="${doc.home}/docs/api"
packagenames="org.*">
<classpath refid="compile.classpath"/>
</javadoc>
</target>
<!-- target name="jsp">
<copy todir="${build.home}">
<fileset dir="web" followsymlinks="false"/>
</copy>
</target -->
<target name="prepare">
<!-- Create build directory and copy static content -->
<mkdir dir="${build.home}"/>
<copy todir="${build.home}">
<fileset dir="web" followsymlinks="false"/>
</copy>
<mkdir dir="${build.home}/forwards/"/>
<!-- copy todir="${build.home}">
<fileset dir="web/forwards" followsymlinks="false"/>
</copy -->
<!-- The "Move Species List Pages" task will not only move the old pages (web/comoros for instance)
to the new location (webapps/antweb/web/speciesList/) but it will generate redirects
(in web/forwards/ that can be copied into the source tree (at antweb/web/forwards/) so that
the antweb perpare task will copy them into the webapps/antweb directory (we don't want
to cruft up the antweb/web directory with all of the forwards. -->
</target>
<!-- Create build directory and copy static content -->
<!-- target name="prepareTest">
<copy todir="${build.home}">
<fileset dir="${add.home}"/>
</copy>
</target -->
<target name="test" depends="compile">
<junit printsummary="true" fork="true">
<test name="test.org.calacademy.antweb.AntWebStrutsTest" />
<classpath>
<pathelement location="${build.home}/WEB-INF/classes" />
<pathelement location="${lib.home}" />
<fileset dir="${lib.home}">
<include name="*.jar"/>
</fileset>
<fileset dir="${catalina.home}/lib">
<include name="*.jar"/>
</fileset>
</classpath>
<!--
<pathelement location="${httpunit.home}/lib/httpunit.jar" />
<pathelement location="${httpunit.home}/lib/JTidy.jar" />
</classpath>
-->
<formatter type="plain" usefile="false" />
</junit>
</target>
<target name="antwebUtil" depends="compile">
<java classname="org.calacademy.antweb.util.AntwebUtil" fork="true">
<classpath>
<pathelement location="${build.home}/WEB-INF/classes" />
<pathelement location="${lib.home}" />
<fileset dir="${lib.home}">
<include name="*.jar"/>
</fileset>
<fileset dir="${catalina.home}/lib">
<include name="*.jar"/>
</fileset>
</classpath>
</java>
</target>
<target name="war" depends="deploy">
<war destfile="antweb.war" webxml="WEB-INF/web.xml">
<fileset dir="build"/>
<lib dir="WEB-INF/lib"/>
<classes dir="build/WEB-INF/classes"/>
</war>
</target>
<target name="warDeploy" depends="war">
<copy todir="${deploy.home}">
<fileset dir="." includes="antweb.war"/>
</copy>
</target>
<!-- These are not being used ... but display unless and echo functionality -->
<target name="debug" depends="setAppName, output">
</target>
<target name="setAppName" unless="app.name">
<property name="app.name" value="antweb"/>
<echo message="setting app.name to be default: antweb"/>
</target>
<target name="output">
<echo message="app.name:${app.name}"/>
<echo message="antweb.home:${antweb.home}"/>
</target>
</project>