-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.xml
292 lines (242 loc) · 13 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
<!-- A "project" describes a set of targets that may be requested
when Ant is executed. The "default" attribute defines the
target which is executed if no specific target is requested,
and the "basedir" attribute defines the current working directory
from which Ant executes the requested task. This is normally
set to the current working directory.
-->
<project name="WebGoat" xmlns:artifact="antlib:org.apache.maven.artifact.ant" default="Build_ALL_OWASP_Releases" basedir=".">
<!-- ===================== Property Definitions =========================== -->
<!--
Each of the following properties are used in the build script.
Values for these properties are set by the first place they are
defined, from the following list:
* Definitions on the "ant" command line (ant -Dfoo=bar compile).
* Definitions from a "build.properties" file in the top level
source directory of this application.
* Definitions from a "build.properties" file in the developer's
home directory.
* Default definitions in this build.xml file.
You will note below that property values can be composed based on the
contents of previously defined properties. This is a powerful technique
that helps you minimize the number of changes required when your development
environment is modified. Note that property composition is allowed within
"build.properties" files as well as in the "build.xml" script.
-->
<property file="build.properties"/>
<property file="${user.home}/build.properties"/>
<!-- ==================== File and Directory Names ======================== -->
<!--
These properties generally define file and directory names (or paths) that
affect where the build process stores its outputs.
build.home The directory into which the "prepare" and
"compile" targets will generate their output.
Defaults to "build".
catalina.home The directory in which you have installed
a binary distribution of Tomcat 4. This will
be used by the "deploy" target.
dist.home The name of the base directory in which
distribution files are created.
Defaults to "dist".
install.home The absolute path of the directory into which
the installer will copy its files. The Eclipse
project is bound to this path.
-->
<property name="app.home" value="${basedir}"/>
<property name="app.name" value="WebGoat"/> <!-- MUST BE CONSISTENT WITH src/main/build.xml! -->
<property name="app.version" value="5.4"/> <!-- MUST BE CONSISTENT WITH src/main/build.xml! -->
<property name="dist.home" value="${app.home}/dist"/>
<property name="dist.owasp" value="${app.home}/owasp_distributions"/>
<property name="install.home" value="WebGoat-${app.version}"/>
<property name="maven.war" value="${basedir}/target/WebGoat-6.0-SNAPSHOT.war"/> <!-- UPDATE THIS! -->
<property name="maven.target" value="${basedir}/target/WebGoat-6.0-SNAPSHOT"/> <!-- UPDATE THIS! -->
<property name="maven.home" value="C:/Program Files (x86)/apache/apache-maven-3.0.3"/> <!-- UPDATE THIS! -->
<property name="java32.home" value="C:/Program Files (x86)/Java/jre7"/> <!-- UPDATE THIS! -->
<property name="java32.ubuntu.home" value="C:/RTC/WebGoat/ubuntu_openjava_6_32"/> <!-- UPDATE THIS! -->
<property name="java64.home" value="C:/Program Files/Java/jdk1.6.0_26"/> <!-- UPDATE THIS! -->
<property name="tomcat32.home" value="C:/RTC/WebGoat/apache-tomcat-7.0.27-x86/"/> <!-- UPDATE THIS! -->
<property name="tomcat64.home" value="C:/RTC/WebGoat/apache-tomcat-7.0.27"/> <!-- UPDATE THIS! -->
<property name="tomcat32.ubuntu.home" value="C:/RTC/WebGoat/ubuntu_tomcat_7_32"/> <!-- UPDATE THIS! -->
<!-- ==================== Clean Target ==================================== -->
<!--
The "clean" target deletes any previous "build" and "dist" directory,
so that you can be ensured the application can be built from scratch.
-->
<target name="cleanwin32"
description="Delete old build and dist directories">
<delete dir="${dist.home}"/>
<delete dir="${tomcat32.home}/logs"/>
<delete dir="${tomcat32.home}/work/Catalina/localhost"/>
<delete dir="${tomcat32.home}/webapps/${app.name}"/>
<delete file="${tomcat32.home}/webapps/${app.name}.war"/>
<delete dir="${tomcat32.home}/server/webapps/${app.name}"/>
<mkdir dir="${dist.home}"/>
<mkdir dir="${tomcat32.home}/logs"/>
</target>
<target name="cleanwin64"
description="Delete old build and dist directories">
<delete dir="${dist.home}"/>
<delete dir="${tomcat64.home}/logs"/>
<delete dir="${tomcat64.home}/work/Catalina/localhost"/>
<delete dir="${tomcat64.home}/webapps/${app.name}"/>
<delete file="${tomcat64.home}/webapps/${app.name}.war"/>
<delete dir="${tomcat64.home}/server/webapps/${app.name}"/>
<mkdir dir="${dist.home}"/>
<mkdir dir="${tomcat64.home}/logs"/>
</target>
<target name="cleanubuntu32"
description="Delete old build and dist directories">
<delete dir="${dist.home}"/>
<delete dir="${tomcat32.ubuntu.home}/logs"/>
<delete dir="${tomcat32.ubuntu.home}/work/Catalina/localhost"/>
<delete dir="${tomcat32.ubuntu.home}/webapps/${app.name}"/>
<delete file="${tomcat32.ubuntu.home}/webapps/${app.name}.war"/>
<delete dir="${tomcat32.ubuntu.home}/server/webapps/${app.name}"/>
<mkdir dir="${dist.home}"/>
<mkdir dir="${tomcat32.ubuntu.home}/logs"/>
</target>
<target name="clean_dist"
description="Delete old build, dist directories and zips">
<delete dir="${dist.home}"/>
<delete dir="${dist.owasp}"/>
<mkdir dir="${dist.home}"/>
<mkdir dir="${dist.owasp}"/>
</target>
<!-- ==================== Dist Target ===================================== -->
<!--
The "dist" target creates a binary distribution of your application
in a directory structure ready to be archived in a tar.gz or zip file.
Note that this target depends on two others:
* "compile" so that the entire web application (including external
dependencies) will have been assembled
-->
<target name="DeployWarWin32"
description="Copy existing war to Tomcat - Does not rebuild">
<!-- Install war to Tomcat -->
<delete dir="${tomcat32.home}/webapps/${app.name}"/>
<delete file="${tomcat32.home}/webapps/${app.name}.war"/>
<copy file="${maven.war}" tofile="${tomcat32.home}/webapps/${app.name}.war"/>
</target>
<target name="DeployWarWin64"
description="Copy existing war to Tomcat - Does not rebuild">
<!-- Install war to Tomcat -->
<delete dir="${tomcat64.home}/webapps/${app.name}"/>
<delete file="${tomcat64.home}/webapps/${app.name}.war"/>
<copy file="${maven.war}" tofile="${tomcat64.home}/webapps/${app.name}.war"/>
</target>
<target name="DeployWarUbuntu32"
description="Copy existing war to Tomcat - Does not rebuild">
<!-- Install war to Tomcat -->
<delete dir="${tomcat32.ubuntu.home}/webapps/${app.name}"/>
<delete file="${tomcat32.ubuntu.home}/webapps/${app.name}.war"/>
<copy file="${maven.war}" tofile="${tomcat32.ubuntu.home}/webapps/${app.name}.war"/>
</target>
<!-- Build J2EE Lab Environment release -->
<target name="Build_DeveloperLab_Release_FIXME" depends="cleanwin32"
description="Builds J2EE Developer Course release">
<!-- Build the WebGoat WAR with the desired properties file -->
<ant dir="${app.home}" inheritAll="false">
<target name="WebGoatPropertiesOWASP"/>
<target name="BuildWar"/>
</ant>
<antcall target="DeployWar"> </antcall>
<!-- Build the CD image -->
<zip destfile="${dist.home}/${ant.project.name}-DeveloperLab-${app.version}.zip">
<zipfileset dir="." prefix="${install.home}"
includes="eclipse/, java/, project/, FirefoxPortable/, Paros/, tomcat/, webscarab/,
Read*.txt, HOW*.txt, eclipse.bat, webgoat.bat, webgoat_8080.bat, webscarab.bat,
Eclipse-Workspace.zip"
excludes="project/.*, project/.settings/**, project/dist/**, project/owasp_distributions/**, project/bin/**, project/build/**"/>
</zip>
</target>
<target name="Build_Class_Release_FIXME" depends="cleanwin32"
description="Builds WebGoat Course release">
<!-- Build the WebGoat WAR with the desired properties file -->
<ant dir="${app.home}" inheritAll="false">
<target name="WebGoatPropertiesOWASP"/>
<target name="BuildWar"/>
</ant>
<antcall target="DeployWar"> </antcall>
<!-- Build the CD image -->
<zip destfile="${dist.home}/${ant.project.name}-Class-${app.version}.zip">
<zipfileset dir="." prefix="${install.home}"
includes="java/, tomcat/, FirefoxPortable/, Paros/, webscarab/, webgoat.bat, webgoat_8080.bat, webscarab.bat"
excludes="project/.*, project/.settings/**, project/dist/**, project/owasp_distributions/**, project/bin/**, project/build/**"/>
</zip>
</target>
<!-- Build OWASP Developer Lab Environment release -->
<target name="Build_OWASP_DeveloperLab_release_FIXME" depends="cleanwin32"
description="Builds OWASP Developer release">
<!-- Build the WebGoat WAR with the desired properties file -->
<ant dir="${app.home}" inheritAll="false">
<target name="WebGoatPropertiesOWASP"/>
<target name="BuildWar"/>
</ant>
<antcall target="DeployWar"> </antcall>
<!-- Build the CD image -->
<zip destfile="${dist.home}/${ant.project.name}-OWASP_Developer-${app.version}.zip">
<zipfileset dir="." prefix="${install.home}"
includes="eclipse/, java/, project/, tomcat/,
read*.txt, HOW*.txt, eclipse.bat, webgoat.bat, webgoat_8080.bat,
Eclipse-Workspace.zip"
excludes="project/.*, project/.settings/**, project/dist/**, project/owasp_distributions/**, project/bin/**, project/build/**"/>
</zip>
</target>
<target name="Build_OWASP_Standard_Release_win32" depends="cleanwin32"
description="Builds WebGoat OWASP win32 release">
<antcall target="DeployWarWin32"> </antcall>
<!-- Build the CD image -->
<zip destfile="${dist.home}/${ant.project.name}-${app.version}-OWASP_Standard_Win32.zip">
<zipfileset dir="." prefix="${install.home}"
includes=", READ*.txt, webgoat.*, webgoat_8080.*"
excludes=".*, .settings/**,dist/**, owasp_distributions/**, bin/**, build/**"/>
<zipfileset dir="${java32.home}" prefix="${install.home}/java"/>
<zipfileset dir="${tomcat32.home}" prefix="${install.home}/tomcat"/>
</zip>
</target>
<target name="Build_OWASP_Standard_Release_win64" depends="cleanwin64"
description="Builds WebGoat OWASP win64 release">
<antcall target="DeployWarWin64"> </antcall>
<!-- Build the CD image -->
<zip destfile="${dist.home}/${ant.project.name}-${app.version}-OWASP_Standard_Win64.zip">
<zipfileset dir="." prefix="${install.home}"
includes=", READ*.txt, webgoat.*, webgoat_8080.*"
excludes=".*, .settings/**,dist/**, owasp_distributions/**, bin/**, build/**"/>
<zipfileset dir="${java64.home}" prefix="${install.home}/java"/>
<zipfileset dir="${tomcat64.home}" prefix="${install.home}/tomcat"/>
</zip>
</target>
<target name="Build_OWASP_Standard_Release_ubuntu32" depends="cleanubuntu32"
description="Builds WebGoat OWASP ubuntu release">
<antcall target="DeployWarUbuntu32"> </antcall>
<!-- Build the CD image -->
<zip destfile="${dist.home}/${ant.project.name}-${app.version}-OWASP_Standard_Ubuntu32.zip">
<zipfileset dir="." prefix="${install.home}"
includes=", READ*.txt, webgoat.*, webgoat_8080.*"
excludes=".*, .settings/**,dist/**, owasp_distributions/**, bin/**, build/**"/>
<zipfileset dir="${java32.ubuntu.home}" prefix="${install.home}/java"/>
<zipfileset dir="${tomcat32.ubuntu.home}" prefix="${install.home}/tomcat"/>
</zip>
</target>
<!--Build all OWASP release -->
<target name="Build_ALL_OWASP_Releases" depends="clean_dist"
description="Creates all binary distributions for OWASP">
<copy file="${basedir}/readme.txt" tofile="${dist.owasp}/readme.txt"/>
<antcall target="Build_OWASP_Standard_Release_win32"> </antcall>
<copydir dest="${dist.owasp}" src="${dist.home}"/>
<antcall target="Build_OWASP_Standard_Release_win64"> </antcall>
<copydir dest="${dist.owasp}" src="${dist.home}"/>
<antcall target="Build_OWASP_Standard_Release_ubuntu32"> </antcall>
<copydir dest="${dist.owasp}" src="${dist.home}"/>
</target>
<!-- ==================== Prepare Target ================================== -->
<!--
The "prepare" target is used to create the "build" destination directory,
and copy the static contents of your web application to it. If you need
to copy static files from external dependencies, you can customize the
contents of this task.
Normally, this task is executed indirectly when needed.
-->
<target name="prepare">
</target>
</project>