-
Notifications
You must be signed in to change notification settings - Fork 0
/
build_tomcat.xml
108 lines (90 loc) · 4.95 KB
/
build_tomcat.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
<!-- The contents of this file wee adapted from ImportAnt (http://sourceforge.net/projects/import-ant) -->
<project name="tomcat">
<fail message="MUST define CATALINA_HOME environment variable" unless="env.CATALINA_HOME" />
<property name="tomcat.dir" location="${env.CATALINA_HOME}" />
<!-- USER NOTE: 'tomcat.username' will have to be defined elsewhere -->
<!-- USER NOTE: 'tomcat.password' will have to be defined elsewhere -->
<property name="tomcat.host" value="localhost" />
<property name="tomcat.port" value="8080" />
<property name="tomcat.protocol" value="http" />
<property name="tomcat.server" value="${tomcat.host}:${tomcat.port}" />
<property name="tomcat.url" value="${tomcat.protocol}://${tomcat.server}" />
<property name="tomcat.web-manager.context.path" value="manager" />
<property name="tomcat.web-manager.url" value="${tomcat.url}/${tomcat.web-manager.context.path}" />
<!-- -->
<!-- PATHS -->
<!-- -->
<!-- development libraries -->
<path id="tomcat.jars.path">
<fileset dir="${tomcat.dir}/lib">
<include name="**/*.jar"/>
</fileset>
</path>
<!-- taskdefs library -->
<path id="catalina-ant.jar.path">
<pathelement location="${tomcat.dir}/lib/catalina-ant.jar"/>
</path>
<!-- -->
<!-- TASKDEFS -->
<!-- -->
<taskdef name="deploy" classname="org.apache.catalina.ant.DeployTask" classpathref="catalina-ant.jar.path" />
<taskdef name="undeploy" classname="org.apache.catalina.ant.UndeployTask" classpathref="catalina-ant.jar.path" />
<taskdef name="list" classname="org.apache.catalina.ant.ListTask" classpathref="catalina-ant.jar.path" />
<taskdef name="install" classname="org.apache.catalina.ant.InstallTask" classpathref="catalina-ant.jar.path"/>
<taskdef name="reload" classname="org.apache.catalina.ant.ReloadTask" classpathref="catalina-ant.jar.path" />
<taskdef name="remove" classname="org.apache.catalina.ant.RemoveTask" classpathref="catalina-ant.jar.path"/>
<taskdef name="start" classname="org.apache.catalina.ant.StartTask" classpathref="catalina-ant.jar.path" />
<taskdef name="stop" classname="org.apache.catalina.ant.StopTask" classpathref="catalina-ant.jar.path" />
<!-- -->
<!-- TARGETS -->
<!-- -->
<!-- MAIN TARGETS (name, description) -->
<target name="deploy"
depends="-check-web-app-user,-check-web-app-context,build,-deploy"
description="Deploy Web application">
</target>
<target name="undeploy"
depends="-check-web-app-user,-check-web-app-context,-undeploy"
description="Undeploy Web application">
</target>
<target name="redeploy"
depends="-check-web-app-user,-check-web-app-context,-undeploy,build,-deploy"
description="Undeploy and deploy Web aplication">
</target>
<target name="quick-deploy"
depends="-check-web-app-user,-check-web-app-context,-quick-deploy-warning,-deploy"
description="Deploy Web application without rebuilding WAR file">
</target>
<target name="quick-redeploy"
depends="-check-web-app-user,-check-web-app-context,-undeploy,-quick-deploy-warning,-deploy"
description="Undeploy and deploy Web aplication without rebuilding WAR file">
</target>
<!-- PRIVATE AUXILIARY TARGETS (-name, no description) -->
<target name="-check-web-app-user">
<fail message="MUST DEFINE tomcat.username PROPERTY" unless="tomcat.username" />
<fail message="MUST DEFINE tomcat.password PROPERTY" unless="tomcat.password" />
</target>
<target name="-check-web-app-context">
<fail message="MUST DEFINE web-app-env.deploy.context PROPERTY" unless="web-app-env.deploy.context" />
</target>
<target name="-quick-deploy-warning">
<echo level="warning" message="Deploying current WAR file. It may be out of date." />
<!-- sleep is here to give time for slower machines to undeploy
web application before new deploy" -->
<sleep seconds="1" />
</target>
<target name="-deploy"
depends="">
<fail message="MUST DEFINE web-app-env.deploy.war.rel-file PROPERTY" unless="web-app-env.deploy.war.rel-file" />
<property name="web-app-env.deploy.war.file" location="${web-app-env.deploy.war.rel-file}" />
<deploy url="${tomcat.web-manager.url}"
username="${tomcat.username}" password="${tomcat.password}"
path="/${web-app-env.deploy.context}" war="file:${web-app-env.deploy.war.file}" />
</target>
<target name="-undeploy"
depends="">
<undeploy url="${tomcat.web-manager.url}"
username="${tomcat.username}" password="${tomcat.password}"
path="/${web-app-env.deploy.context}" />
</target>
</project>