Tomcat 시작
<target name="tomcatStart">
<echo message="Start Tomcat" />
<exec dir="${env.CATALINA_HOME}/bin" executable="cmd.exe">
<arg line="/c startup.bat" />
</exec>
</target>
Tomcat 정지
<target name="tomcatStop">
<echo message="Stop Tomcat" />
<echo message="Start Tomcat" />
<exec dir="${env.CATALINA_HOME}/bin" executable="cmd.exe">
<arg line="/c shutdown.bat" />
</exec>
</target>
Tomcat 프로젝트 별로 처리
먼저 프로젝트 별로 처리 하기 위해서는 ${CATALINA_HOME}\lib 폴더 안에 있는 ${ANT_HOME}\lib 폴더 안에
catalina-ant.jar
tomcat-coyote.jar
tomcat-util.jar
파일들을 복사해야 한다.
프로젝트 시작
<taskdef name="stop" classname="org.apache.catalina.ant.StopTask" />
<target name="tomcatProjectStop">
<echo message="Stop Tomcat Project : ${projectName}" />
<stop url="${tomcat.manager.url}" username="${tomcat.manager.username}"
password="${tomcat.manager.password}"
path="/${projectName}">
</stop>
</target>
프로젝트 정지
<taskdef name="start" classname="org.apache.catalina.ant.StartTask" />
<target name="tomcatProjectStart">
<echo message="Start Tomcat Project : ${projectName}" />
<start url="${tomcat.manager.url}"
username="${tomcat.manager.username}"
password="${tomcat.manager.password}"
path="/${projectName}">
</start>
</target>
프로젝트 Deploy
<taskdef name="deploy" classname="org.apache.catalina.ant.DeployTask" />
<target name="tomcatDeploy" depends="deploy">
<deploy url="${tomcat.manager.url}"
username="${tomcat.manager.username}"
password="${tomcat.manager.password}"
path="/${projectName}"
war="file:${projectName}.war"
update="true">
</deploy>
</target>
프로젝트 UNDeploy
<taskdef name="undeploy" classname="org.apache.catalina.ant.UndeployTask" />
<target name="tomcatDeploy" depends="deploy">
<undeploy url="${tomcat.manager.url}"
username="${tomcat.manager.username}"
password="${tomcat.manager.password}"
path="/${projectName}">
</undeploy>
</target>