How to set up a webapps deployment directory in Jetty

It should be a dead simple answer, but I just can't find it!

I just started using Jetty 7.0.2 on CentOS 5.5 and deployed webapp with default settings (just by placing my WAR file in /webapps ). When Jetty starts, it extracts the war in the directory /tmp/jetty {something-warfilename-etc}.

I understand that Jetty has a lot of customizable configurations that can be implemented, but right now I'm just interested in setting the location of the extracted military files so that I can modify .properties , etc. safe on the fly.

Thanks in advance!

+4
source share
2 answers

Why not just put the unpacked war file in webapps/ ?

As their docs say , if Jetty finds a directory in $JETTY_HOME/webapps/ , he will gladly expand it as a webapp servlet. You can then edit the properties file without changing the Jetty settings.

This also means that you don’t have to worry about Jetty overwriting any changes to the properties files when you have a new version of the application (although you still need to be careful).

+6
source

I know this question is old, but I wanted to get an answer to this question, which was a configuration parameter and not an unpacked WAR solution. The configuration decision should add the following parameter to WebAppProvider (in 8.1.8, this is in jetty-webapps.xml ):

 <Set name="tempDir"><New class="java.io.File"><Arg>/usr/local/jetty-8.1.8/work</Arg></New></Set> 

so that the general configuration file reads something like:

 <Configure id="Server" class="org.eclipse.jetty.server.Server"> <Ref id="DeploymentManager"> <Call id="webappprovider" name="addAppProvider"> <Arg> <New class="org.eclipse.jetty.deploy.providers.WebAppProvider"> <Set name="monitoredDirName"><Property name="jetty.home" default="." />/webapps</Set> <Set name="defaultsDescriptor"><Property name="jetty.home" default="."/>/etc/webdefault.xml</Set> <Set name="scanInterval">1</Set> <Set name="contextXmlDir"><Property name="jetty.home" default="." />/contexts</Set> <Set name="extractWars">true</Set> <Set name="tempDir"><New class="java.io.File"><Arg>/usr/local/jetty-8.1.8/work</Arg></New></Set> </New> </Arg> </Call> </Ref> </Configure> 
+3
source

All Articles