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
The Jenkins Web application ARchive (WAR) file can be started from the command line like this: Download the latest stable Jenkins WAR file to an appropriate directory on your machine. Open up a terminal/command prompt window to the download directory. Run the command java -jar jenkins.
The easiest way to deploy a web application to Jetty server is probably by copying the WAR file into the $JETTY_HOME/webapps directory. Jetty will scan its $JETTY_HOME/webapps directory at startup for web applications to deploy. Our new app will be deployed at /jetty-app context.
Standalone Startup The easiest way to start Jetty, is to use the start. jar that comes with the distribution. The default options may be specified in the start. ini file, or if that is not present, they are defined in the start.
To start Jetty, switch on the command line to the installation directory and issue the following command. To stop Jetty press Ctrl + C . To start Jetty as Windows service you can use Apache Procrun.
Use the jetty runner.
java -jar jetty-runner.jar my.war With Maven, you can install by adding to your pom.xml:
<build> ... <plugins> ... <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-dependency-plugin</artifactId> <version>2.3</version> <executions> <execution> <phase>package</phase> <goals><goal>copy</goal></goals> <configuration> <artifactItems> <artifactItem> <groupId>org.mortbay.jetty</groupId> <artifactId>jetty-runner</artifactId> <version>7.5.4.v20111024</version> <destFileName>jetty-runner.jar</destFileName> </artifactItem> </artifactItems> </configuration> </execution> </executions> </plugin> </plugins> </build> Run:
mvn package And use as:
java -jar target/dependency/jetty-runner.jar target/*.war http://www.eclipse.org/jetty/documentation/current/runner.html
http://central.maven.org/maven2/org/eclipse/jetty/jetty-runner/
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:
mvn archetype:generate \ -DarchetypeGroupId=org.duelengine \ -DarchetypeArtifactId=war-bootstrap-archetype \ -DarchetypeVersion=0.2.1 Then you launch it like this:
java -jar bootstrap.jar -war myapp.war -p 8080 -c /myapp --jetty Here's the source for the utility and the archetype: https://bitbucket.org/mckamey/war-bootstrap
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With