Jetty Run War Using only command line

Viewed 55746

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
5 Answers

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

  1. Have a command line that was more like

    java -jar $jettyHome/start.jar -Dwar.location=myApp.war -DcontextPath=/myApp jetty-myapp.xml
    

    or

    java -jar $jettyHome/start.jar -Dwar.location=myApp.war -DcontextPath=/myApp etc/jetty.xml etc/jetty-plus.xml jetty-deploy-app.xml
    
  2. 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.

Related