1 <?xml version="1.0" encoding="UTF-8"?>
3 Copyright (c) 2017 Politecnico di Torino and others.
5 All rights reserved. This program and the accompanying materials
6 are made available under the terms of the Apache License, Version 2.0
7 which accompanies this distribution, and is available at
8 http://www.apache.org/licenses/LICENSE-2.0
10 <project basedir="." name="tomcat-build">
12 Script for Controlling Tomcat (to be imported in main build)
15 <property name="tomcatUsername" value="to_be_defined" />
16 <property name="tomcatPassword" value="to_be_defined" />
17 <property name="server.location" location="to_be_defined" />
18 <property name="tomcatPort" value="8080" />
19 <property name="tomcatUrl" value="http://localhost:${tomcatPort}/manager/text" />
20 <property name="root.location" location="." />
21 <!--PROPERTIES AND TASKS TO BE OVERRIDDEN BY MAIN BUILD-->
22 <property name="serviceName" value="verigraph" />
23 <property name="rootDirectoryWS" value="verigraph"/>
25 <path id="tomcat.class.path">
26 <fileset dir="${server.location}/lib">
27 <include name="**/*.jar" />
28 <include name="**/*.zip" />
30 <pathelement location="${server.location}/bin/bootstrap.jar" />
31 <pathelement location="${server.location}/bin/tomcat-juli.jar" />
34 <!-- Configure the custom Ant tasks for the Manager application -->
35 <import file="${server.location}/bin/catalina-tasks.xml" />
38 <!-- TOMCAT LIFECICLE MANAGEMENT-->
39 <target name="start-tomcat" depends="check-tomcat-status" unless="tomcat.started">
40 <echo>Start Tomcat</echo>
41 <java classname="org.apache.catalina.startup.Bootstrap" fork="true"
42 classpathref="tomcat.class.path">
43 <jvmarg value="-Dcatalina.home=${server.location}/" />
48 <target name="stop-tomcat" depends="check-tomcat-status" if="tomcat.started">
49 <echo>Stop Tomcat</echo>
50 <java classname="org.apache.catalina.startup.Bootstrap" fork="true"
51 classpathref="tomcat.class.path">
52 <jvmarg value="-Dcatalina.home=${server.location}/" />
58 <target name="check-tomcat-status">
59 <condition property="tomcat.started">
60 <socket server="localhost" port="${tomcatPort}" />
65 <!-- WEBSERVICE LIFECICLE MANAGEMENT-->
66 <target name="deployWS" description="Deploy service to tomcat">
67 <echo>Deploying to tomcat...</echo>
68 <deploy url="${tomcatUrl}" username="${tomcatUsername}"
69 password="${tomcatPassword}" path="/${serviceName}"
70 war="file:${root.location}/war/${serviceName}.war"
75 <target name="undeployWS" description="Undeploy to tomcat">
76 <echo>Undeploying...</echo>
77 <undeploy url="${tomcatUrl}" username="${tomcatUsername}"
78 password="${tomcatPassword}" path="/${serviceName}" failonerror="false"/>
82 <target name="startWS" description="Start service in tomcat">
83 <echo>Starting...</echo>
84 <start url="${tomcatUrl}" username="${tomcatUsername}" password="${tomcatPassword}"
85 path="/${serviceName}" />
89 <target name="stopWS" description="Stop service in tomcat">
90 <echo>Stopping...</echo>
91 <stop url="${tomcatUrl}" username="${tomcatUsername}" password="${tomcatPassword}"
92 path="/${serviceName}" />
96 <target name="reloadWS" description="Reload service in tomcat">
97 <echo>Reloading...</echo>
98 <reload url="${tomcatUrl}" username="${tomcatUsername}" password="${tomcatPassword}"
99 path="/${serviceName}" />
103 <target name="redeployWS" depends="undeployWS" description="Redeploy service in tomcat">
104 <antcall target="deployWS" />