Reputation: 11298
I would like to have a portable Jetty Server. The default jetty.home directory contains
JettyHome │ ├─etc │ ├─ jetty.xml │ ├─ jetty-logging.xml │ ├─ jetty-plus.xml │ └─ webdefault.xml ├─logs │ ├─lib │ ├─ jetty-6.1.26.jar │ └─ other.jar ├─webapps │ └─MyWebApp.war ├─ start.jar └─ start.ini
From the above, I would like to eliminate etc
and lib
directory and keep the following
JettyHome │ ├─logs ├─webapps │ └─MyWebApp.war └─ start.jar
I packed all the lib
folder jars into start.jar using OneJar along with start.ini
. Is there any way to keep etc
folder contents inside the jar so that I can simply run
java -Xmx640M -jar rw.jar
instead of
java -Xmx640M -jar rw.jar etc/jetty.xml etc/jetty-annotations.xml etc/jetty-deploy.xml etc/jetty-logging.xml etc/jetty-webapps.xml
So I can have a portable release and I never worry about changing configuration by someone in client place.
Thanks.
Upvotes: 0
Views: 1073
Reputation: 7182
Your best bet is to embed jetty into your application.
http://wiki.eclipse.org/Jetty/Tutorial/Embedding_Jetty
With this you simply need to have the jetty jars in the classpath and you should be good to go. You can even slurp everything into the one jar like you want and have a Main class in the manifest that starts everything off.
The xml files are really just a thin layer of xml over java anyway. Take a look at some of the embedded examples here and that should clue you into the correct approach.
Upvotes: 1