Repository navigation
Expand file tree
/
Copy pathbuild.xml
More file actions
227 lines (200 loc) · 8.89 KB
/
Copy pathbuild.xml
File metadata and controls
227 lines (200 loc) · 8.89 KB
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
<?xml version="1.0"?>
<project name="MicroPassManager" basedir="." default="usage">
<property file="build.properties"/>
<property name="name" value="MicroPassManager"/>
<property name="src.dir" value="src"/>
<property name="lib.dir" value="lib"/>
<property name="gensrc.dir" value="gensrc"/>
<property name="test.dir" value="testsrc"/>
<property name="resources.dir" value="resources"/>
<property name="web.dir" value="war"/>
<property name="build.classes.dir" value="${web.dir}/WEB-INF/classes"/>
<property name="build.lib.dir" value="${web.dir}/WEB-INF/lib"/>
<property name="java.src.version" value="1.8"/>
<property name="java.tgt.version" value="1.8"/>
<path id="master-classpath">
<fileset dir="${web.dir}/WEB-INF/lib">
<include name="*.jar"/>
</fileset>
<fileset dir="${lib.dir}">
<include name="*.jar"/>
</fileset>
<!-- We need the servlet API classes -->
<fileset dir="${tomcat.lib.dir}">
<include name="servlet*.jar"/>
</fileset>
<pathelement path="${build.classes.dir}"/>
</path>
<path id="test-classpath">
<fileset dir="${lib.dir}">
<include name="*.jar"/>
</fileset>
<!-- We need the servlet API classes -->
<fileset dir="${tomcat.lib.dir}">
<include name="servlet*.jar"/>
</fileset>
<pathelement path="${build.classes.dir}"/>
</path>
<path id="catalina-ant-classpath">
<!-- We need the Catalina jars for Tomcat; * for other app servers - check the docs -->
<fileset dir="${tomcat.lib.dir}">
<include name="catalina-ant.jar"/>
<include name="tomcat-util.jar"/>
</fileset>
</path>
<!-- *** taskdefs *** -->
<taskdef name="testng" classpathref="test-classpath" classname="org.testng.TestNGAntTask" />
<!-- *** targets *** -->
<target name="usage">
<echo message="${name} build file"/>
<echo message="-----------------------------------"/>
<echo message="Available targets are:"/>
<echo message="clean --> Clean"/>
<echo message="build --> Build the application"/>
<echo message="rebuild --> Clean and build the application"/>
<echo message="tests-build --> Build tests"/>
<echo message="tests-run --> Run tests with ant"/>
<echo message="tests-debug --> Debug tests"/>
<echo message="create-war --> Deploy application as a WAR file"/>
<echo message=" * Tomcat built-in targets * "/>
<echo message="tomcat-deploy --> Start Tomcat server"/>
<echo message="tomcat-start --> Start Tomcat server"/>
<echo message="tomcat-reload --> Reload application in Tomcat"/>
<echo message="tomcat-stop --> Stop Tomcat server"/>
<echo message="tomcat-list --> List Tomcat applications"/>
<echo message=" * Other targets * "/>
<echo message="tomcat-undeploy --> Undeploy application from Tomcat"/>
</target>
<target name="all-prod" depends="rebuild,tomcat-deploy,tomcat-start" description="rebuild,tests-run,tomcat-deploy,tomcat-list"/>
<target name="all-dev" depends="rebuild,tests-run,tomcat-deploy,tomcat-list,tomcat-start" description="rebuild,tests-run,tomcat-deploy,tomcat-list"/>
<target name="clean" description="Clean output directories">
<delete >
<fileset dir="${build.classes.dir}">
<include name="**/*"/>
</fileset>
<fileset dir="${build.lib.dir}">
<include name="**/*"/>
</fileset>
</delete>
</target>
<target name="build" description="Compile main source tree java files">
<mkdir dir="${build.classes.dir}"/>
<javac destdir="${build.classes.dir}" source="${java.src.version}" target="${java.tgt.version}" debug="true"
deprecation="false" optimize="false" failonerror="true">
<src path="${src.dir}"/>
<classpath refid="master-classpath"/>
</javac>
<copy todir="${build.lib.dir}" preservelastmodified="true">
<fileset dir="${lib.dir}">
<include name="**/*.jar"/>
</fileset>
</copy>
<copy todir="${build.classes.dir}" preservelastmodified="true">
<fileset dir="${resources.dir}">
<include name="**/*.*"/>
</fileset>
</copy>
</target>
<target name="rebuild" depends="clean,build" description="Clean and build"/>
<target name="tests-build" description="Compile test tree java files">
<mkdir dir="${build.classes.dir}"/>
<javac destdir="${build.classes.dir}" source="${java.src.version}" target="${java.tgt.version}" debug="true"
deprecation="false" optimize="false" failonerror="true">
<src path="${test.dir}"/>
<classpath refid="test-classpath"/>
</javac>
</target>
<target name="tests-run" depends="build, tests-build" description="Run tests">
<testng mode="testng" classpathref="test-classpath"
failureproperty="tests.failed" verbose="1">
<classfileset dir="${build.classes.dir}" includes="**/*Test.class"/>
<jvmarg value="-Dfile.encoding=UTF-8"/>
</testng>
<fail if="tests.failed">
tests.failed=${tests.failed}
***********************************************************
***********************************************************
**** One or more tests failed! Check the output ... ****
***********************************************************
***********************************************************
</fail>
</target>
<target name="tests-debug" depends="build, tests-build" description="Debug tests">
<testng mode="testng" dumpCommand="true" classpathref="test-classpath"
failureproperty="tests.failed" verbose="2">
<classfileset dir="${build.classes.dir}" includes="**/*Test.class"/>
<jvmarg value="-Xdebug"/>
<jvmarg value="-Xnoagent"/>
<jvmarg value="-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8990" />
<jvmarg value="-Dfile.encoding=UTF-8"/>
</testng>
</target>
<target name="create-war" depends="build" description="Deploy application as a WAR file">
<mkdir dir="output"/>
<delete>
<fileset dir="output">
<include name="**/*.*"/>
</fileset>
</delete>
<war destfile="output/${name}.war" needxmlfile="false" >
<fileset dir="${web.dir}">
<include name="**/*.*"/>
</fileset>
</war>
</target>
<!-- ============================================================== -->
<!-- Tomcat tasks - remove these if you don't have Tomcat installed -->
<!-- ============================================================== -->
<taskdef name="tomcat-deploy" classname="org.apache.catalina.ant.DeployTask">
<classpath refid="catalina-ant-classpath"/>
</taskdef>
<taskdef name="tomcat-reload" classname="org.apache.catalina.ant.ReloadTask">
<classpath refid="catalina-ant-classpath"/>
</taskdef>
<taskdef name="tomcat-list" classname="org.apache.catalina.ant.ListTask">
<classpath refid="catalina-ant-classpath"/>
</taskdef>
<taskdef name="tomcat-start" classname="org.apache.catalina.ant.StartTask" >
<classpath refid="catalina-ant-classpath"/>
</taskdef>
<taskdef name="tomcat-stop" classname="org.apache.catalina.ant.StopTask">
<classpath refid="catalina-ant-classpath"/>
</taskdef>
<target name="tomcat-deploy" depends="create-war" description="Deploy application in Tomcat 8">
<copy todir="${tomcat.deploy.dir}" preservelastmodified="true">
<fileset dir="output">
<include name="*.war"/>
</fileset>
</copy>
<tomcat-deploy url="${tomcat.manager.url}" username="${tomcat.manager.username}"
password="${tomcat.manager.password}" path="/${name}" war="output/${name}.war"/>
</target>
<target name="tomcat-reload" description="Reload application in Tomcat">
<tomcat-reload url="${tomcat.manager.url}" username="${tomcat.manager.username}"
password="${tomcat.manager.password}" path="/${name}"/>
</target>
<target name="tomcat-start" description="Start app on Tomcat server">
<tomcat-start url="${tomcat.manager.url}" username="${tomcat.manager.username}"
password="${tomcat.manager.password}" path="/${name}" />
</target>
<target name="tomcat-stop" description="Stop app on Tomcat server">
<tomcat-stop url="${tomcat.manager.url}" username="${tomcat.manager.username}"
password="${tomcat.manager.password}" path="/${name}"/>
</target>
<target name="tomcat-list" description="List Tomcat applications">
<tomcat-list url="${tomcat.manager.url}" username="${tomcat.manager.username}"
password="${tomcat.manager.password}"/>
</target>
<target name="tomcat-undeploy" depends="tomcat-stop" description="Un-Deploy application">
<delete>
<fileset dir="${tomcat.deploy.dir}/${name}">
<include name="**/*"/>
</fileset>
<fileset dir="${tomcat.deploy.dir}">
<include name="${name}.war"/>
</fileset>
<dirset dir="${tomcat.deploy.dir}/${name}"/>
</delete>
</target>
<!-- End Tomcat tasks -->
</project>