Is it possible to use only the command line to Run jetty
with only a specified war
file and Context Path.
Something like :
java -jar $jettyHome/start.jar -Dwar.location=myApp.war -DcontextPath=/myApp OPTIONS=default,plus,jsp
Is it possible to use only the command line to Run jetty
with only a specified war
file and Context Path.
Something like :
java -jar $jettyHome/start.jar -Dwar.location=myApp.war -DcontextPath=/myApp OPTIONS=default,plus,jsp
Using jetty-runner-minimal:
It's possible, if you have the appropriate start config (jetty.xml) set up.
Out of the box, jetty doesn't ship with a jetty.xml that does that, but you could write one easily enough.
That would mean you'd either
Have a command line that was more like
or
Override the etc/jetty.xml yourself and put the info you want in there.
Jetty startup is pretty straight forward, so it's really just about producing an XML file that does what you want. That XML file can read values from system properties, so you can use your various "-D" options.
I've written a tiny command line app / Maven archetype which works like how I thought this all should have in the first place. The bootstrap app lets you launch your servlet container of choice (Jetty, Tomcat, GlassFish) by just passing it the path to the WAR and your port.
Using Maven, you can create and package your own instance of this simple app:
Then you launch it like this:
Here's the source for the utility and the archetype: https://bitbucket.org/mckamey/war-bootstrap
install maven from command line:
run war from command line on folder, where pom.xml:
Use the jetty runner.
With Maven, you can install by adding to your
pom.xml
:Run:
And use as:
http://www.eclipse.org/jetty/documentation/current/runner.html
http://central.maven.org/maven2/org/eclipse/jetty/jetty-runner/