-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathbuild.xml
250 lines (168 loc) · 7.6 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
<project xmlns:ivy="antlib:org.apache.ivy.ant" name="scidrive" default="dist" basedir=".">
<property file="build.properties"/>
<property file="${user.home}/build.properties"/>
<property name="app.name" value="vospace-2.0"/>
<property name="app.path" value="/${app.name}"/>
<property name="app.version" value="0.1-beta"/>
<property name="build.home" value="${basedir}/build"/>
<property name="dist.home" value="${basedir}/dist"/>
<property name="docs.home" value="${basedir}/docs"/>
<property name="src.home" value="${basedir}/src"/>
<property name="lib.home" value="${basedir}/lib"/>
<property name="web.home" value="${basedir}/web"/>
<property name="local.lib.home" value="${basedir}/lib.local"/>
<property name="catalina.lib.home" value="${basedir}/lib.catalina"/>
<!-- ================================= Ivy install ================================= -->
<property name="ivy.install.version" value="2.3.0" />
<condition property="ivy.home" value="${env.IVY_HOME}">
<isset property="env.IVY_HOME" />
</condition>
<property name="ivy.home" value="${user.home}/.ant" />
<property name="ivy.jar.dir" value="${ivy.home}/lib" />
<property name="ivy.jar.file" value="${ivy.jar.dir}/ivy-${ivy.install.version}.jar" />
<target name="download-ivy" unless="offline">
<mkdir dir="${ivy.jar.dir}"/>
<!-- download Ivy from web site so that it can be used even without any special installation -->
<get src="http://repo2.maven.org/maven2/org/apache/ivy/ivy/${ivy.install.version}/ivy-${ivy.install.version}.jar"
dest="${ivy.jar.file}" usetimestamp="true"/>
</target>
<target name="init-ivy" depends="download-ivy">
<path id="ivy.lib.path">
<fileset dir="${ivy.jar.dir}" includes="*.jar"/>
</path>
<taskdef resource="org/apache/ivy/ant/antlib.xml"
uri="antlib:org.apache.ivy.ant" classpathref="ivy.lib.path"/>
</target>
<!-- ================================= Resolve Catalina ================================= -->
<target name="resolve_catalina" depends="init-ivy" description="--> retrieve dependencies with ivy for Catalina">
<ivy:retrieve conf="catalina" pattern="${catalina.lib.home}/[artifact](-[classifier]).[ext]"/>
<path id="catalina.classpath">
<fileset dir="${catalina.lib.home}">
<include name="*.jar"/>
</fileset>
</path>
<taskdef name="reload" classname="org.apache.catalina.ant.ReloadTask">
<classpath refid="catalina.classpath"/>
</taskdef>
<taskdef name="deploy" classname="org.apache.catalina.ant.DeployTask">
<classpath refid="catalina.classpath"/>
</taskdef>
<taskdef name="undeploy" classname="org.apache.catalina.ant.UndeployTask">
<classpath refid="catalina.classpath"/>
</taskdef>
</target>
<!-- ==================== Compilation Control Options ==================== -->
<property name="compile.debug" value="true"/>
<property name="compile.deprecation" value="false"/>
<property name="compile.optimize" value="true"/>
<!-- ==================== Compilation Classpath =========================== -->
<path id="compile.classpath">
<fileset dir="${lib.home}">
<include name="*.jar"/>
</fileset>
<fileset dir="${local.lib.home}">
<include name="*.jar"/>
</fileset>
</path>
<!-- ==================== All Target ====================================== -->
<!--
The "all" target is a shortcut for running the "clean" target followed
by the "compile" target, to force a complete recompile.
-->
<target name="all" depends="clean,compile"
description="Clean build and dist directories, then compile"/>
<!-- ==================== Clean Target ==================================== -->
<target name="clean"
description="Delete old build and dist directories">
<delete dir="${build.home}"/>
<delete dir="${dist.home}"/>
</target>
<!-- ==================== Compile Target ================================== -->
<!--
The "compile" target transforms source files (from your "src" directory)
into object files in the appropriate location in the build directory.
This example assumes that you will be including your classes in an
unpacked directory hierarchy under "/WEB-INF/classes".
-->
<target name="compile" description="Compile Java sources">
<mkdir dir="${build.home}"/>
<mkdir dir="${build.home}/WEB-INF"/>
<mkdir dir="${build.home}/WEB-INF/classes"/>
<!-- Copy static content of this web application -->
<copy todir="${build.home}/WEB-INF" file="${web.home}/WEB-INF/web.xml"/>
<!-- Compile Java classes as necessary -->
<javac srcdir="${src.home}"
destdir="${build.home}/WEB-INF/classes"
debug="${compile.debug}"
deprecation="${compile.deprecation}"
includeantruntime="false"
optimize="${compile.optimize}">
<classpath refid="compile.classpath"/>
<classpath refid="catalina.classpath"/>
</javac>
<!-- Copy application resources -->
<copy todir="${build.home}/WEB-INF/classes">
<fileset dir="${src.home}" excludes="**/*.java"/>
</copy>
<copy todir="${build.home}/WEB-INF/lib">
<path refid="compile.classpath"/>
</copy>
<copy todir="${build.home}/WEB-INF/lib/Lib">
<fileset dir="${lib.home}/Lib"/>
</copy>
</target>
<target name="try" depends="dist,undeploy,deploy"
description="Create binary distribution">
</target>
<!-- ================================= Resolve Target ================================= -->
<target name="resolve" depends="init-ivy" description="--> retrieve dependencies with ivy">
<ivy:retrieve conf="compile"/>
</target>
<!-- ================================= Dist Target ================================= -->
<target name="dist" depends="resolve_catalina,resolve,compile"
description="Create war file">
<mkdir dir="${dist.home}"/>
<war jarfile="${dist.home}/${app.name}.war" basedir="${build.home}">
<metainf dir=".">
<include name="NOTICE"/>
<include name="LICENSE"/>
</metainf>
</war>
</target>
<!-- ==================== Undeploy Target ================================== -->
<target name="undeploy" depends="resolve_catalina"
description="undeploy application to a remote servlet container">
<undeploy url="${manager.url}"
username="${manager.username}"
password="${manager.password}"
path="${app.path}"/>
</target>
<!-- ==================== Deploy Target ================================== -->
<target name="deploy" depends="resolve_catalina,dist"
description="Deploy application to a remote servlet container">
<tstamp/>
<deploy url="${manager.url}"
username="${manager.username}"
password="${manager.password}"
path="${app.path}"
war="/${dist.home}/${app.name}.war"/>
</target>
<!-- ==================== Javadoc Target ================================== -->
<target name="javadoc" depends="compile"
description="Create Javadoc API documentation">
<mkdir dir="${dist.home}/docs/api"/>
<javadoc sourcepath="${src.home}"
destdir="${dist.home}/docs/api"
packagenames="*">
<classpath refid="compile.classpath"/>
</javadoc>
</target>
<!-- ==================== Reload Target =================================== -->
<target name="reload"
description="Reload application on servlet container">
<reload url="${manager.url}"
username="${manager.username}"
password="${manager.password}"
path="${app.path}"/>
</target>
</project>