Jenkins : Jetty

Jenkins 1.535 and above bundles on Jetty, so you can just run java -jar jenkins.war. On Jenkins CI, Winstone 2.0 is the command line interface around Jetty. The following instructions apply when you want to run your own Jetty installation.

Installation

Copy the jenkins.war file to webapp directory, under debian this may be /usr/share/jetty/webapp

Hudson before 1.344 causes a problem with Jetty that results in a failure to retrieve update center data. If you need to work around this problem without upgrading, see JENKINS-5210.

You may see:
Unable to create the home directory '/usr/share/jetty/.jenkins'. This is most likely a permission problem. 

This worked for me:
as root

mkdir /home/jetty
chown jetty:adm /home/jetty
echo export JENKINS_HOME=/home/jetty/ > /etc/profile.d/systemwide.sh

 restart jetty

or add

<Call class="java.lang.System" name="setProperty">
  <Arg>JENKINS_HOME</Arg>
  <Arg>/home/jetty</Arg>
</Call>

to jetty.xml

As of Jetty 8.1.0 due to a bug fix an explicit security realm is required.  This can be given in the context (e.g. contexts/jenkins.xml) like the example below.

<Configure class="org.eclipse.jetty.webapp.WebAppContext">
  <Set name="contextPath">/jenkins</Set>
  <Set name="war"><SystemProperty name="jetty.home" default="."/>/webapps/jenkins.war</Set>
  <Get name="securityHandler">
    <Set name="loginService">
      <New class="org.eclipse.jetty.security.HashLoginService">
        <Set name="name">Jenkins Realm</Set>
        <Set name="config"><SystemProperty name="jetty.home" default="."/>/etc/realm.properties</Set>
      </New>
    </Set>
  </Get>
</Configure>