Jetty Run War Using only command line

前端 未结 5 686
梦谈多话
梦谈多话 2020-12-22 23:48

Is it possible to use only the command line to Run jetty with only a specified war file and Context Path.

Something like :

         


        
5条回答
  •  被撕碎了的回忆
    2020-12-23 00:34

    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.

提交回复
热议问题