Skip to content

Instantly share code, notes, and snippets.

@pdeschen
Last active May 6, 2016 16:09
Show Gist options
  • Save pdeschen/50a48ef270bdb6f75ca0 to your computer and use it in GitHub Desktop.
Save pdeschen/50a48ef270bdb6f75ca0 to your computer and use it in GitHub Desktop.
run-jetty-run!
#!/bin/bash
# usage: jetty -Dfoo=bar --path services --port 8080 path/to/war/file.war
# last 5 args are forwarded to jetty while remainder (if any) is forward to jvm
# such as system properties or remote debugging ala
# -Xrunjdwp:transport=dt_socket,address=8787,server=y,suspend=n
length=$(($#-5))
jvm_args=${@:1:$length}
jetty_args=${@:$length+1:$(($#))}
VERSION=9.3.8.v20160314
if [ ! -e ~/.jetty/jetty-runner-$VERSION.jar ] ; then
if [ ! -e ~/.jetty/ ] ; then
mkdir ~/.jetty/
fi
curl --progress-bar -s http://repo1.maven.org/maven2/org/eclipse/jetty/jetty-runner/$VERSION/jetty-runner-$VERSION.jar > ~/.jetty/jetty-runner-$VERSION.jar
fi
java -Dcom.sun.management.jmxremote -Xdebug -Xnoagent -server $jvm_args -jar ~/.jetty/jetty-runner-$VERSION.jar $jetty_args
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment