start and stop Tomcat from ANT

To Start and stop tomcat using Ant is fairly very simple, 
1.Create a build.xml file.
2. Set TOMCAT_HOME=[TOMCAT INSTLL DIR] in Classpath of the System
3. Write the below ant task
<target name="startTomcat">
    <java jar="${tomcat_home}/bin/bootstrap.jar" fork="true">
        <jvmarg value="-Dcatalina.home=${tomcat_home}"/>
    </java>
</target>

<target name="stopTomcat">
    <java jar="${tomcat_home}/bin/bootstrap.jar" fork="true">
        <jvmarg value="-Dcatalina.home=${tomcat_home}"/>
        <arg line="stop"/>
    </java>
</target>

--
Thanks

Advertisements

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.