-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.xml
147 lines (128 loc) · 6.25 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
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns:ivy="antlib:org.apache.ivy.ant" name="ant_tomcat" default="all" basedir=".">
<!-- include tomcat info -->
<property file="tomcat.properties"/>
<!-- ivy properties -->
<property name="ivy.install.version" value="2.4.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.jar" />
<!-- dirs -->
<property name="src" value="src"/>
<property name="web" value="web"/>
<property name="web.build.dir" value="${web}/WEB-INF"/>
<property name="web.build.dir.classes" value="${web.build.dir}/classes"/>
<property name="web.xml" value="${web.build.dir}/web.xml"/>
<property name="web.src.dir" value="${src}/main/java"/>
<property name="war.file" value="simple.war"/>
<property name="lib" value="lib"/>
<!-- tomcat properties -->
<property name="tomcat.context" value="${context}" />
<property name="tomcat.home.dir" location="${catalina.home}" />
<property name="tomcat.base.url" value="${base.url}" />
<property name="tomcat.manager.url" value="${manager.url}" />
<property name="tomcat.user.name" value="${manager.username}" />
<property name="tomcat.user.password" value="${manager.password}" />
<path id="tomcat.classpath">
<!-- We need the Catalina jars for Tomcat -->
<fileset dir="${tomcat.home.dir}/lib">
<include name="catalina-ant.jar"/>
<include name="tomcat-coyote.jar"/>
<include name="tomcat-util.jar"/>
</fileset>
<fileset dir="${tomcat.home.dir}/bin">
<include name="tomcat-juli.jar"/>
</fileset>
</path>
<!-- Configure the custom Ant tasks for the Manager application -->
<taskdef name="deploy" classname="org.apache.catalina.ant.DeployTask" classpathref="tomcat.classpath"/>
<taskdef name="list" classname="org.apache.catalina.ant.ListTask" classpathref="tomcat.classpath"/>
<taskdef name="reload" classname="org.apache.catalina.ant.ReloadTask" classpathref="tomcat.classpath"/>
<taskdef name="findleaks" classname="org.apache.catalina.ant.FindLeaksTask" classpathref="tomcat.classpath"/>
<taskdef name="resources" classname="org.apache.catalina.ant.ResourcesTask" classpathref="tomcat.classpath"/>
<taskdef name="start" classname="org.apache.catalina.ant.StartTask" classpathref="tomcat.classpath"/>
<taskdef name="stop" classname="org.apache.catalina.ant.StopTask" classpathref="tomcat.classpath"/>
<taskdef name="undeploy" classname="org.apache.catalina.ant.UndeployTask" classpathref="tomcat.classpath"/>
<path id="classpath.test">
<pathelement location="${lib}/junit-4.12.jar"/>
<pathelement location="${lib}/hamcrest-core-1.3.jar"/>
<pathelement location="${web.build.dir.classes}"/>
</path>
<path id="classpath.servlet">
<pathelement location="${lib}/javax.servlet-api-3.0.1.jar"/>
<pathelement location="${web.build.dir.classes}"/>
</path>
<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">
<!-- try to load ivy here from ivy home, 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>
<target name="resolve-test" depends="init-ivy">
<!-- see conf "test" in ivy.xml -->
<ivy:retrieve conf="test"
type="jar,bundle"
sync="true"
pattern="${lib}/[module]-[revision].[ext]"/>
</target>
<target name="resolve-compile" depends="init-ivy">
<!-- see conf "compile" in ivy.xml -->
<ivy:retrieve conf="compile"
type="jar,bundle"
sync="true"
pattern="${lib}/[module]-[revision].[ext]"/>
</target>
<target name="compile" depends="resolve-compile">
<mkdir dir="${web.build.dir.classes}"/>
<javac srcdir="${web.src.dir}" destdir="${web.build.dir.classes}" includeantruntime="false" >
<classpath refid="classpath.servlet"/>
</javac>
</target>
<target name="war" depends="compile">
<war destfile="${war.file}" webxml="${web.xml}">
<fileset dir="${web}">
<include name="**/*.*"/>
<exclude name="${web.xml}" />
</fileset>
<classes dir="${web.build.dir.classes}"/>
</war>
</target>
<target name="all" depends="war">
</target>
<target name="undeploy">
<!-- TOMCAT undeploy-->
<undeploy
url="${tomcat.manager.url}"
username="${tomcat.user.name}"
password="${tomcat.user.password}"
path="/${tomcat.context}"
/>
</target>
<target name="deploy" depends="clean, war">
<!-- TOMCAT deploy-->
<deploy
url="${tomcat.manager.url}"
username="${tomcat.user.name}"
password="${tomcat.user.password}"
path="/${tomcat.context}"
localWar="file:${basedir}/${war.file}"
update="true"
/>
</target>
<target name="clean" description="Clean classes dir and war file">
<delete dir="${web.build.dir.classes}"/>
<delete file="${war.file}"/>
</target>
</project>