/
build.xml
219 lines (182 loc) · 8.1 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
<?xml version="1.0" standalone="yes"?>
<!--
===============================================================================
MTBWI Library build file
===============================================================================
-->
<project name="mtbwi" default="debug" basedir=".">
<description>
mtbwi is the Java Web Interface into the MTB system.
</description>
<!--===================== Property Definitions =============================-->
<!--<property name="tomcat.root" value="C:/Program Files/Apache Software Foundation/Apache Tomcat 8.0.27/"/>-->
<property name="app.version" value="1"/>
<property name="app.name" value="mtbwi"/>
<property name="app.path" value="/mtbwi"/>
<property name="src.java.home" value="${basedir}/src/java"/>
<property name="web.xml" value="build/WEB-INF/web.xml"/>
<property name="dist.war.name" value="${app.name}.war"/>
<property name="dist.zip.name" value="${app.name}.zip"/>
<property file="build.properties"/>
<!-- Import here to inherit the properties set from above.
<import file="../common.xml"/> -->
<!--===================== External Dependencies ============================-->
<property name="JavaToHTML.jar" value="lib/JavaToHTML.jar"/>
<property name="mtbdao.jar" value="lib/mtbdao.jar"/>
<property name="mtbutils.jar" value="lib/mtbutils.jar"/>
<property name="CacheFilter.jar" value="lib/CacheFilter.jar"/>
<property name="context.xml" value="conf/context.xml"/>
<!--===================== Custom Classpath =================================-->
<path id="project.classpath">
<!-- <fileset dir="${tomcat.root}/lib">
<include name="*.jar"/>
</fileset> -->
<fileset dir="lib/jstl-1.1.2">
<include name="**/*.jar"/>
</fileset>
<fileset dir="lib/struts-1.2.8">
<include name="**/*.jar"/>
</fileset>
</path>
<!-- Import here to inherit the properties set from above. -->
<import file="./common.xml"/>
<!--
===============================================================================
Prepare Target
===============================================================================
The "prepare" target is used to create the necessary build directory
structure 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.
The prepareCalled property ensures that clean will only be called once per
invocation even though it may be called more than once.
-->
<target name="prepare" depends="clean,compile"
if="ant.project.name" unless="prepareCalled">
<echo message="Preparing file structure..."/>
<mkdir dir="${build.home}"/>
<mkdir dir="${build.home}/META-INF"/>
<mkdir dir="${build.home}/WEB-INF"/>
<mkdir dir="${build.home}/WEB-INF/classes"/>
<mkdir dir="${build.home}/WEB-INF/lib"/>
<mkdir dir="${build.home}/WEB-INF/tags"/>
<available file="${build.home}"
type="dir"
property="prepareCalled"/>
<copy todir="${build.home}">
<fileset dir="${web.home}"/>
</copy>
<echo message="CLASSES.HOME = ${classes.home}"/>
<move todir="${build.home}/WEB-INF/classes">
<fileset dir="${classes.home}"/>
</move>
<copy flatten="true" todir="${build.home}/WEB-INF/lib">
<fileset dir="${lib.home}">
<include name="**/*.jar" />
<include name="**/*.zip" />
<exclude name="**/servlet-api.jar" />
<exclude name="**/jsp-api.jar" />
</fileset>
</copy>
<copy todir="${build.home}/live">
<fileset dir="live">
<include name="**/*" />
<exclude name="**/mtbwi.properties"/>
</fileset>
</copy>
</target>
<!--===================== Custom Prepare Target ============================-->
<target name="projectPrepare" depends="prepare"
description="Prepare the web application.">
<mkdir dir="${build.home}"/>
<loadproperties srcFile="conf/build.properties"/>
<echo message="Preparing file structure specifically for project..."/>
<echo message="BUILDING ${build.version}"/>
<!-- copy and replace -->
<!-- <copy file="conf/context.xml" todir="build/META-INF" overwrite="true"/>
<replace file="build/META-INF/context.xml"
replacefilterfile="conf/build.properties"/>
<copy file="conf/security.xml" todir="build/META-INF" overwrite="true"/>
<replace file="build/META-INF/security.xml"
replacefilterfile="conf/build.properties"/>
-->
<copy file="${src.java.home}/log4j.properties" todir="${build.home}/WEB-INF/classes" overwrite="true"/>
<replace file="${build.home}/WEB-INF/classes/log4j.properties"
replacefilterfile="conf/build.properties"/>
<copy file="${src.java.home}/log4j2.properties" todir="${build.home}/WEB-INF/classes" overwrite="true"/>
<replace file="${build.home}/WEB-INF/classes/log4j2.properties"
replacefilterfile="conf/build.properties"/>
<copy file="web/WEB-INF/web.xml" todir="build/WEB-INF" overwrite="true"/>
<replace file="build/WEB-INF/web.xml"
replacefilterfile="conf/build.properties"/>
<!-- mtbwi.properties is not provided in source control
<copy file="live/mtbwi.properties" todir="build/live" overwrite="true"/>
<replace file="build/live/mtbwi.properties"
replacefilterfile="conf/build.properties"/>
-->
<!-- Copy the TAG libraries -->
<mkdir dir="build/WEB-INF/tags"/>
<copy todir="build/WEB-INF/tags"
overwrite="true"
file="web/WEB-INF/tags/TimerTag.tag"/>
<copy todir="build/WEB-INF"
overwrite="true"
file="lib/MTBWebUtils.tld"/>
<copy todir="build/WEB-INF">
<fileset dir="lib/struts-1.2.8">
<include name="**/*.dtd"/>
<include name="**/*.tld"/>
<include name="**/*.xml"/>
</fileset>
<fileset dir="lib/jstl-1.1.2">
<include name="**/*.dtd"/>
<include name="**/*.tld"/>
<include name="**/*.xml"/>
</fileset>
</copy>
</target>
<!--===================== Custom Dist Target ===============================-->
<target name="projectDeployLocal" description="Prepare the web application.">
<echo message="Preparing WAR file for Local Deployment..."/>
<echo message="Copying conf/build.local.properties to conf/build.properties"/>
<copy file="conf/build.local.properties"
tofile="conf/build.properties"
overwrite="true"/>
<antcall target="projectPrepare"/>
<antcall target="webdist"/>
<copy file="dist/mtbwi.war"
tofile="C:/LocalMTBWI/mtbwi.war"
overwrite="true"/>
<tstamp>
<format property="current.time" pattern="MM/dd/yyyy hh:mm:ss aa" />
</tstamp>
<echo message="finished at ${current.time}" />
</target>
<target name="projectDistDev" description="Prepare the web application.">
<echo message="Preparing WAR file for DEVELOPMENT..."/>
<echo message="Copying conf/build.dev.properties to conf/build.properties"/>
<copy file="conf/build.dev.properties"
tofile="conf/build.properties"
overwrite="true"/>
<antcall target="projectPrepare"/>
<antcall target="webdist"/>
</target>
<target name="projectDistProd" description="Prepare the web application.">
<echo message="Preparing WAR file for PRODUCTION..."/>
<echo message="Copying conf/build.prod.properties to conf/build.properties"/>
<copy file="conf/build.prod.properties"
tofile="conf/build.properties"
overwrite="true"/>
<antcall target="projectPrepare"/>
<antcall target="webdist"/>
</target>
<target name="projectDistPub" description="Prepare the web application.">
<echo message="Preparing WAR file for PUBLIC..."/>
<echo message="Copying conf/build.pub.properties to conf/build.properties"/>
<copy file="conf/build.pub.properties"
tofile="conf/build.properties"
overwrite="true"/>
<antcall target="projectPrepare"/>
<antcall target="webdist"/>
</target>
</project>