2009-12-01

Jetty Runner

You always get into situations when you want to try a web application. You have your bleeding-edge.war, how do you run it? Most commonly i find myself repeating the following routine:


mkdir test-bleeding-edge-war
cd test-bleeding-edge-war/
unzip ~/Downloads/apache-tomcat-6.0.20.zip

cd apache-tomcat-6.0.20/
cp ~/Downloads/bleeding-edge.war webapps/
chmod +x bin/*.sh
tail -f logs/catalina.out


It's way easier with jetty-runner. Just download the latest jetty-runner.jar from the maven repo: http://repo2.maven.org/maven2/org/mortbay/jetty/jetty-runner/

Once you downloaded it you can right away start your war file as the root context:

java -jar ~/Downloads/jetty-runner.jar ~/Downloads/bleeding-edge.war


No jetty install is needed as it's embedded to the jetty-runner.jar. No environment variables needs to be set (like CATALINA_HOME or JETTY_HOME). No fluff just stuff!

For the most common configurations you have command-line options. Like running the web-server on port 9080 (instead of the standard 8080):


java -jar ~/Downloads/jetty-runner.jar --port 9080 ~/Downloads/bleeding-edge.war


If you want to get all available command-line options just use no options at all, or specify --help

java -jar ~/Downloads/jetty-runner.jar --port 9080 ~/Downloads/bleeding-edge.war


Or read the developer blog about it: http://blogs.webtide.com/janb/entry/jetty_runner