Skip to content

Ant Tomcat

December 1, 2007

Html Encoder:
http://www.opinionatedgeek.com/DotNet/Tools/HTMLEncode/Encode.aspx

there are 2 ways to do it:
<target name=”tomcat-start”>
<java jar=”${tomcat.home}/bin/bootstrap.jar” fork=”true”>
<jvmarg value=”-Dcatalina.home=${tomcat.home}”/>
</java>
</target>

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

You can have in build.properties, something like the following entry:

tomcat.home=E:/peter/opt/apache-tomcat-5.5.12

Combine these ant targets with a “war” task. The Tomcat Reload Ant task can also be used to speed up development time.One of the advantages of this approach is that you can extend it to start Tomcat for remote debugging

<target name=”tomcat-start-debug”>
<java jar=”${tomcat.home}/bin/bootstrap.jar” fork=”true”>
<jvmarg value=”-Dcatalina.home=${tomcat.home}”/>
<jvmarg value=”-Xdebug”/>
<jvmarg
value=”-Xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=n”/>
</java>
</target>

==============================

<property name="name" value="newapp"/>
<taskdef name="start" classname="org.apache.catalina.ant.StartTask">
<classpath>
<path location="${appserver.home}/server/lib/catalina-ant.jar"/>
</classpath>
</taskdef>
<taskdef name="stop" classname="org.apache.catalina.ant.StopTask">
<classpath>
<path location="${appserver.home}/server/lib/catalina-ant.jar"/>
</classpath>
</taskdef>
<target name="start" description="Start Tomcat application">
<start url="${tomcat.manager.url}"
username="${tomcat.manager.username}"
password="${tomcat.manager.password }"
path="/${name}"/>
</target>

<target name="stop" description="Stop Tomcat application">
<stop url="${tomcat.manager.url}"
username="${ tomcat.manager.username}"
password="${tomcat.manager.password}"
path="/${name}"/>
</target>

And make a file build.properties which contains variables used by build.xml

# Ant properties for building the springapp
appserver.home=${user.home}/jakarta-tomcat-5.0.28
deploy.path=${appserver.home}/webapps
tomcat.manager.url=http://localhost:8080/manager
tomcat.manager.username=admin
tomcat.manager.password=tomcat

http://raibledesigns.com/wiki/Wiki.jsp?page=TomcatAntTasks
Advertisements
No comments yet

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com 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 )

Google+ photo

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

Connecting to %s

%d bloggers like this: