1
|
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
<project default="-deploy-ant" basedir=".">
|
3
|
<target name="-init" if="deploy.ant.enabled">
|
4
|
<property file="${deploy.ant.properties.file}"/>
|
5
|
<tempfile property="temp.module.folder" prefix="tomcat" destdir="${java.io.tmpdir}"/>
|
6
|
<unwar src="${deploy.ant.archive}" dest="${temp.module.folder}">
|
7
|
<patternset includes="META-INF/context.xml"/>
|
8
|
</unwar>
|
9
|
<xmlproperty file="${temp.module.folder}/META-INF/context.xml"/>
|
10
|
<delete dir="${temp.module.folder}"/>
|
11
|
</target>
|
12
|
<target name="-check-credentials" if="deploy.ant.enabled" depends="-init">
|
13
|
<fail message="Tomcat password has to be passed as tomcat.password property.">
|
14
|
<condition>
|
15
|
<not>
|
16
|
<isset property="tomcat.password"/>
|
17
|
</not>
|
18
|
</condition>
|
19
|
</fail>
|
20
|
</target>
|
21
|
<target name="-deploy-ant" if="deploy.ant.enabled" depends="-init,-check-credentials">
|
22
|
<echo message="Deploying ${deploy.ant.archive} to ${Context(path)}"/>
|
23
|
<taskdef name="deploy" classname="org.apache.catalina.ant.DeployTask">
|
24
|
<classpath>
|
25
|
<pathelement path="${tomcat.home}/lib/catalina-ant.jar"/>
|
26
|
<pathelement path="${tomcat.home}/lib/tomcat-coyote.jar"/>
|
27
|
<pathelement path="${tomcat.home}/lib/tomcat-util.jar"/>
|
28
|
<pathelement path="${tomcat.home}/bin/tomcat-juli.jar"/>
|
29
|
</classpath>
|
30
|
</taskdef>
|
31
|
<deploy url="${tomcat.url}/manager/text" username="${tomcat.username}"
|
32
|
password="${tomcat.password}" path="${Context(path)}"
|
33
|
war="${deploy.ant.archive}"/>
|
34
|
<property name="deploy.ant.client.url" value="${tomcat.url}${Context(path)}"/>
|
35
|
</target>
|
36
|
<target name="-undeploy-ant" if="deploy.ant.enabled" depends="-init,-check-credentials">
|
37
|
<echo message="Undeploying ${Context(path)}"/>
|
38
|
<taskdef name="undeploy" classname="org.apache.catalina.ant.UndeployTask">
|
39
|
<classpath>
|
40
|
<pathelement path="${tomcat.home}/lib/catalina-ant.jar"/>
|
41
|
<pathelement path="${tomcat.home}/lib/tomcat-coyote.jar"/>
|
42
|
<pathelement path="${tomcat.home}/lib/tomcat-util.jar"/>
|
43
|
<pathelement path="${tomcat.home}/bin/tomcat-juli.jar"/>
|
44
|
</classpath>
|
45
|
</taskdef>
|
46
|
<undeploy url="${tomcat.url}/manager/text" username="${tomcat.username}"
|
47
|
password="${tomcat.password}" path="${Context(path)}"/>
|
48
|
</target>
|
49
|
</project>
|