-
Notifications
You must be signed in to change notification settings - Fork 0
/
tomcat-build.xml
95 lines (78 loc) · 3.58 KB
/
tomcat-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
<?xml version="1.0" encoding="UTF-8"?>
<project basedir="." name="tomcat-build">
<description>
Script for Controlling Tomcat (to be imported in main build)
</description>
<property environment="env"/>
<property name="tomcatUsername" value="root" />
<property name="tomcatPassword" value="root" />
<property name="server.location" location="${env.CATALINA_HOME}" />
<property name="tomcatPort" value="8080" />
<property name="tomcatUrl" value="http://localhost:${tomcatPort}/manager/text" />
<!--PROPERTIES AND TASKS TO BE OVERRIDDEN BY MAIN BUILD-->
<property name="service.name" value="service" />
<property name="root.location" value="." />
<target name="package-service">
</target>
<path id="tomcat.class.path">
<fileset dir="${server.location}/lib">
<include name="**/*.jar" />
<include name="**/*.zip" />
</fileset>
<pathelement location="${server.location}/bin/bootstrap.jar" />
<pathelement location="${server.location}/bin/tomcat-juli.jar" />
</path>
<!-- Configure the custom Ant tasks for the Manager application -->
<import file="${server.location}/bin/catalina-tasks.xml" />
<!-- TOMCAT LIFECICLE MANAGEMENT-->
<target name="start-tomcat" depends="check-tomcat-status" unless="tomcat.started" description="Start tomcat server">
<echo>Start Tomcat</echo>
<java classname="org.apache.catalina.startup.Bootstrap" fork="true"
classpathref="tomcat.class.path">
<jvmarg value="-Dcatalina.home=${server.location}" />
<jvmarg value="-Dit.polito.dp2.NFV.lab3.Neo4JSimpleXMLURL=${Neo4JSimpleXMLURL}" />
<!--jvmarg value="-Dit.polito.dp2.NFV.Random.seed=${seed}" /-->
<jvmarg value="-Dit.polito.dp2.NFV.NfvReaderFactory=${NfvInfo.NfvReaderFactory}" />
</java>
</target>
<target name="stop-tomcat" depends="check-tomcat-status" if="tomcat.started" description="Stop tomcat server">
<echo>Stop Tomcat</echo>
<java classname="org.apache.catalina.startup.Bootstrap" fork="true"
classpathref="tomcat.class.path">
<jvmarg value="-Dcatalina.home=${server.location}" />
<arg line="stop" />
</java>
</target>
<target name="check-tomcat-status">
<condition property="tomcat.started">
<socket server="localhost" port="${tomcatPort}" />
</condition>
</target>
<!-- WEBSERVICE LIFECICLE MANAGEMENT-->
<target name="deployWS" depends="package-service" description="(re-)Deploy service to tomcat">
<echo>Deploying to tomcat...</echo>
<deploy url="${tomcatUrl}" username="${tomcatUsername}"
password="${tomcatPassword}" path="/${service.name}" update="true"
localWar="file:${root.location}/war/${service.name}.war" />
</target>
<target name="undeployWS" description="Undeploy service in tomcat">
<echo>Undeploying...</echo>
<undeploy url="${tomcatUrl}" username="${tomcatUsername}"
password="${tomcatPassword}" path="/${service.name}" failonerror="false"/>
</target>
<target name="startWS" description="Start service in tomcat">
<echo>Starting...</echo>
<start url="${tomcatUrl}" username="${tomcatUsername}" password="${tomcatPassword}"
path="/${service.name}" />
</target>
<target name="stopWS" description="Stop service in tomcat">
<echo>Stopping...</echo>
<stop url="${tomcatUrl}" username="${tomcatUsername}" password="${tomcatPassword}"
path="/${service.name}" />
</target>
<target name="reloadWS" description="Reload service in tomcat">
<echo>Reloading...</echo>
<reload url="${tomcatUrl}" username="${tomcatUsername}" password="${tomcatPassword}"
path="/${service.name}" />
</target>
</project>