jenkins自动部署war包到jetty

1.把jenkins.war包复制到jetty的webapps下面
2.在jetty的webapps下面新建jenkins.xml文件
 内容如下:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "http://www.eclipse.org/jetty/configure_9_0.dtd">
<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>
3.配置jetty热部署
  在jetty的start.ini文件中加入:
  jetty.deploy.monitoredDirName=webapps
  jetty.deploy.scanInterval=1
4.启动jetty: 
   在jetty根目录下:java -jar start.jar
5.在jenkins中项目配置中填写post steps脚本,linux服务器上选execute shell
  例如:
  cd target
  cp lanyue-api.war /home/app/jetty/webapps

 

posted @ 2017-01-14 17:14  如果我爱你  阅读(2406)  评论(0编辑  收藏  举报