Last active
August 29, 2015 14:07
-
-
Save lihonosov/ff89db39a0a69cd5e2aa to your computer and use it in GitHub Desktop.
Ant tomcat targets
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <project name="testproject" default="tomcat-start"> | |
| <property name="tomcat.home" value="/Downloads/apache-tomcat"/> | |
| <path id="tomcat.class.path"> | |
| <fileset dir="${tomcat.home}/lib"> | |
| <include name="**/*.jar"/> | |
| <include name="**/*.zip"/> | |
| </fileset> | |
| <pathelement location="${tomcat.home}/bin/bootstrap.jar"/> | |
| <pathelement location="${tomcat.home}/bin/tomcat-juli.jar"/> | |
| </path> | |
| <target name="deploy" depends="war"> | |
| <sequential> | |
| <antcall target="tomcat-stop"/> | |
| <delete dir="${tomcat.home}/webapps/${dist.context}" failonerror="false"/> | |
| <copy file="${dist.dir}/${dist.filename}" todir="${tomcat.home}/webapps"/> | |
| <antcall target="tomcat-start"/> | |
| </sequential> | |
| </target> | |
| <target name="tomcat-start"> | |
| <java classname="org.apache.catalina.startup.Bootstrap" fork="true" | |
| classpathref="tomcat.class.path"> | |
| <jvmarg value="-Dcatalina.home=${tomcat.home}"/> | |
| </java> | |
| </target> | |
| <target name="tomcat-stop" depends="tomcat-check-status" if="tomcat.started"> | |
| <java classname="org.apache.catalina.startup.Bootstrap" fork="true" | |
| classpathref="tomcat.class.path"> | |
| <jvmarg value="-Dcatalina.home=${tomcat.home}"/> | |
| <arg line="stop"/> | |
| </java> | |
| <sleep seconds="5"/> | |
| </target> | |
| <target name="tomcat-restart"> | |
| <antcall target="tomcat-stop" /> | |
| <antcall target="tomcat-start" /> | |
| </target> | |
| <target name="tomcat-check-status"> | |
| <condition property="tomcat.started"> | |
| <socket server="localhost" port="8080"/> | |
| </condition> | |
| </target> | |
| </project> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment