-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.xml
276 lines (226 loc) · 11.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
<?xml version="1.0" encoding="UTF-8"?>
<!-- =================================
Introduction to Service Design and Engineering Laboratory
Description: ANT build script for the session on JAXB and Dozer
Author: cdparra
Notes:
* This build file includes targets to download and install in your local project the Apache IVY jar
* IVY is used to manage dependencies on projects (e.g., jaxb libraries, jackson libraries for json, etc.)
*
TO USE IVY IN YOUR PROJECTS IN ORDER TO GET MANAGE DEPENDENCIES, MAKE SURE THE FOLLOWING LINES ARE
IN YOUR BUILD.XML UNTILL 'IVY-END-LINE'
# The target "download-ivy" and "install-ivy" will download the ivy jar and place it in the "ivy" folder
#
-->
<project name="AdapterServcice_introsde-2015-FinalProject" default="compile" basedir="." xmlns:ivy="antlib:org.apache.ivy.ant">
<!-- PART 1: Ivy properties, download, installation and configuration -->
<property name="ivy.install.version" value="2.4.0-rc1" />
<property name="ivy.jar.dir" value="${basedir}/ivy" />
<property name="ivy.jar.file" value="${ivy.jar.dir}/ivy.jar" />
<!-- this targe will donwload ivy.jar if its inot in the "ivy" folder yet -->
<target name="download-ivy" unless="skip.download">
<mkdir dir="${ivy.jar.dir}" />
<!-- download Ivy from web site so that it can be used even without any special installation -->
<echo message="installing ivy..." />
<get src="http://repo1.maven.org/maven2/org/apache/ivy/ivy/${ivy.install.version}/ivy-${ivy.install.version}.jar" dest="${ivy.jar.file}" usetimestamp="true" />
</target>
<!--
=================================
target: install-ivy
this target is not necessary if you put ivy.jar in your ant lib directory
if you already have ivy in your ant lib, you can simply remove this
target and the dependency the 'init' target has on it
=================================
-->
<target name="install-ivy" depends="download-ivy" description="--> install ivy">
<!--
try to load ivy here from local ivy dir, in case the user has not already dropped
it into ant's lib dir (note that the latter copy will always take precedence).
We will not fail as long as local lib dir exists (it may be empty) and
ivy is in at least one of ant's lib dir or the local lib dir.
-->
<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>
<!-- PART 2: General properties definitions -->
<property name="build.dir" value="build" />
<property name="src.dir" value="src" />
<property name="doc.dir" value="doc" />
<property name="lib.dir" value="WebContent/WEB-INF/lib" />
<property name="web.dir" value="." />
<property name="webcontent.dir" value="WebContent" />
<!-- =================================
target: resolve downloads the dependencies to your lib folder
================================= -->
<target name="resolve" depends="install-ivy" description="--> retrieve dependencies with ivy">
<ivy:retrieve pattern="${lib.dir}/[type]s-[artifact]-[revision].[ext]" />
</target>
<!-- paths where ivy libraries will be downloaded, use them as classpathref in your compilation and running tasks -->
<path id="lib.path.id">
<fileset dir="${lib.dir}" />
</path>
<path id="run.path.id">
<path refid="lib.path.id" />
<fileset dir="${build.dir}">
<include name="*.class" />
<include name="**/*.class" />
<!-- <exclude name="**/*Test*" /> -->
</fileset>
</path>
<!-- PART 3: compilation and execution targets for this session -->
<target name="init" depends="install-ivy, resolve">
<echo message="Init has been called" />
<mkdir dir="${build.dir}" />
<echo message="${build.dir} has been created" />
</target>
<!-- target: delete generated file and folder -->
<target name="clean">
<echo message="Clean has been called" />
<delete dir="${build.dir}" />
<echo message="${build.dir} has been deleted" />
<delete dir="${src.dir}/${xjc.package}" />
<echo message="${src.dir}/${xjc.package} has been deleted" />
<delete dir="${ivy.jar.dir}" />
<echo message="${ivy.jar.dir} has been deleted" />
<delete dir="${lib.dir}"/>
<echo message="${lib.dir} has been deleted" />
</target>
<target name="install" depends="clean, init">
<echo message="Compile target has been called" />
<javac srcdir="${src.dir}" destdir="${build.dir}" classpathref="lib.path.id" includeAntRuntime="false">
</javac>
<copy todir="${build.dir}" overwrite="true">
<fileset dir="${src.dir}">
<include name="*.xml" />
<include name="**/*.xml" />
</fileset>
</copy>
<copy todir="${build.dir}" overwrite="true">
<fileset dir="${webcontent.dir}">
<include name="*.xml" />
<include name="**/*.xml" />
</fileset>
</copy>
</target>
<target name="compile" depends="clean, init">
<echo message="Compile target has been called" />
<javac srcdir="${src.dir}" destdir="${build.dir}" classpathref="lib.path.id" includeAntRuntime="false">
</javac>
<copy todir="${build.dir}" overwrite="true">
<fileset dir="${src.dir}">
<include name="*.xml" />
<include name="**/*.xml" />
</fileset>
</copy>
<copy todir="${build.dir}" overwrite="true">
<fileset dir="${webcontent.dir}">
<include name="*.xml" />
<include name="**/*.xml" />
</fileset>
</copy>
</target>
<target name="start" depends="install">
<echo message="app start introsde.finalproject.rest.ad.App in ${build.dir}" />
<java classname="introsde.finalproject.rest.ad.App" classpath="${build.dir}" fork="true">
<arg value="$JAVA_OPTS -cp" />
<classpath>
<path location="build" />
<fileset dir="WebContent/WEB-INF/lib">
<include name="**/*.jar" />
<include name="*.jar" />
</fileset>
</classpath>
</java>
</target>
<!-- Connecting client to my server -->
<target name="execute.client.myserver" depends="install">
<record name="client-server-json-myserver.log" action="start"/>
<antcall target="execute.client.myserver.json"></antcall>
<record name="client-server-json-myserver.log" action="stop"/>
<record name="client-server-xml-myserver.log" action="start"/>
<antcall target="execute.client.myserver.xml"></antcall>
<record name="client-server-xml-myserver.log" action="stop"/>
</target>
<!-- end client connection to my server -->
<!-- Executing the client connecting to my server with media.type xml -->
<target name="execute.client.myserver.xml">
<java classname="ehealth.client.TestClient" classpath="build">
<arg value="xml"/>
<arg value="https://enigmatic-sierra-2066.herokuapp.com/sdelab"/>
<classpath>
<path location="build" />
<fileset dir="WebContent/WEB-INF/lib">
<include name="**/*.jar" />
<include name="*.jar" />
</fileset>
</classpath>
</java>
</target>
<!-- Executing the client connecting to my server with media.type json -->
<target name="execute.client.myserver.json">
<java classname="ehealth.client.TestClient" classpath="build">
<arg value="json"/>
<arg value="https://enigmatic-sierra-2066.herokuapp.com/sdelab"/>
<classpath>
<path location="build" />
<fileset dir="WebContent/WEB-INF/lib">
<include name="**/*.jar" />
<include name="*.jar" />
</fileset>
</classpath>
</java>
</target>
<!-- Start client for the assignment calling the friend server -->
<target name="execute.client" depends="install">
<record name="client-server-json.log" action="start"/>
<antcall target="execute.client.friend.json"></antcall>
<record name="client-server-json.log" action="stop"/>
<record name="client-server-xml.log" action="start"/>
<antcall target="execute.client.friend.xml"></antcall>
<record name="client-server-xml.log" action="stop"/>
</target>
<!-- end client for the assignment calling the friend server -->
<!-- Executing the client connecting to friend server with media.type xml -->
<target name="execute.client.friend.xml">
<java classname="ehealth.client.TestClient" classpath="build">
<arg value="xml"/>
<arg value="https://peaceful-hamlet-5616.herokuapp.com/sdelab"/>
<classpath>
<path location="build" />
<fileset dir="WebContent/WEB-INF/lib">
<include name="**/*.jar" />
<include name="*.jar" />
</fileset>
</classpath>
</java>
</target>
<!-- Executing the client connecting to friend server with media.type json -->
<target name="execute.client.friend.json">
<java classname="ehealth.client.TestClient" classpath="build">
<arg value="json"/>
<arg value="https://peaceful-hamlet-5616.herokuapp.com/sdelab"/>
<classpath>
<path location="build" />
<fileset dir="WebContent/WEB-INF/lib">
<include name="**/*.jar" />
<include name="*.jar" />
</fileset>
</classpath>
</java>
</target>
<!-- make sure you have created first the WebContent folder, including a META-INF folder, WEB-INF/web.xml file and WEB-INF/lib folder -->
<target name="create.war" depends="install">
<war destfile="sdelab06.war" webxml="${web.dir}/WebContent/WEB-INF/web.xml">
<fileset dir="${web.dir}/WebContent">
<include name="**/*.*" />
</fileset>
<classes dir="${build.dir}" />
</war>
</target>
<!-- Generate javadocs for current project into ${doc.dir} -->
<target name="generate.doc" depends="init" description="generate documentation">
<javadoc sourcepath="${src.dir}" destdir="${doc.dir}"/>
</target>
</project>