The easy Weblog and Wiki Software
[ start | index | login ]
start > Snipsnap and Tomcat

Snipsnap and Tomcat

Created by rhensle. Last edited by rhensle, 4 years and 136 days ago. Viewed 2,755 times. #5
[diff] [history] [edit] [rdf]
labels
attachments
build.xml (28413)
Tomcat allows a web application to be deployed, undeployed, and reloaded while the container is still running. The following changes to the build.xml file allow for a tomcat-install, tomcat-reload, and tomcat-remove targets.

These changes assume that Tomcat 5.0.19 has been installed on the local computer. Tomcat can be found here >>http://jakarta.apache.org/tomcat. To enable the Tomcat ant task, the file server/lib/catalina-ant.jar must be place in the lib directory of your ant install. This is documented in the Tomcat documentation.

The following changes are made to the build.xml to enable the tomcat-install, tomcat-reload targets. While developing, the tomcat-install target is executed once. The tomcat-reload target is executed each time the application needs to be recompiled and tested. These targets use the web application created in the cls/webapp directory, so be careful with the clean target.

Add these lines near the top of the build.xml

<property name="manager.url" value="http://localhost:8080/manager" />
    <property name="manager.username" value="admin" />
    <property name="manager.password" value="tomcat" />

<taskdef name="deploy" classname="org.apache.catalina.ant.DeployTask" /> <taskdef name="list" classname="org.apache.catalina.ant.ListTask" /> <taskdef name="reload" classname="org.apache.catalina.ant.ReloadTask" /> <taskdef name="undeploy" classname="org.apache.catalina.ant.UndeployTask" />

Rename the snipsnap-war target to prepare-snipsnap-war, and remove the last task that makes the war file. then add the following target after the prepare-snipsnap-war target.

<!-- jar up the web application template -->
    <target depends="prepare-snipsnap-war"
            description="build template war"
            name="snipsnap-war">
        <jar destfile="${jar}/${appname}.war">
            <fileset dir="${target}/webapp" includes="**" />
        </jar>
    </target>

Add these targets near the bottom of the build.xml

<target depends="prepare-snipsnap-war"
            description="manager install to tomcat"
            name="tomcat-install">
        <deploy url="${manager.url}"
                username="${manager.username}"
                password="${manager.password}"
                path="/${appname}"
                localWar="file://${target}/webapp" />
    </target>

<target depends="prepare-snipsnap-war" description="manager reload to tomcat" name="tomcat-reload"> <reload url="${manager.url}" username="${manager.username}" password="${manager.password}" path="/${appname}" /> </target>

<target name="tomcat-list" description="List installed applications on servlet container"> <list url="${manager.url}" username="${manager.username}" password="${manager.password}" /> </target>

<target name="tomcat-remove" description="Remove snipsnap from tomcat"> <undeploy url="${manager.url}" username="${manager.username}" password="${manager.password}" path="/${appname}" /> </target>

5 comments (by erik, suxx0011, janssk1, leo, jsurfer) | post comment

What is SnipSnap?
SnipSnap is a free and easy to install weblog and wiki tool written in Java.

SnipSnap download
Current version: 1.0b3-uttoxeter
Try our >>Web Start Demo!

Resources

5567 Users and 13713 Snips. Installed 6 years and 40 days ago

Logged in Users: (2)
… and 12 Guests.

snipsnap-changed for older changes.

< August 2008 >
SunMonTueWedThuFriSat
12
3456789
10111213141516
17181920212223
24252627282930
31

snipsnap
Listed on BlogShares
XHTML 1.0 validated
CSS validated
RSS 2.0 validated
RSS Feed

pico-powered

Powered by SnipSnap 1.0b3-uttoxeter
YourKit >>Java Profiler

Fraunhofer FIRST

snipsnap.org | Copyright 2000-2006 Fraunhofer FIRST