jenkins远程部署配置

jenkins远程部署配置

1、安装Deploy Plugin(1.9)插件
This plugin takes a war/ear file and deploys that to a running remote application server at the end of a build. The implementation is based on Cargo. The list of currently supported containers include:

Tomcat 4.x/5.x/6.x/7.x
JBoss 3.x/4.x
Glassfish 2.x/3.x
远程部署不包括resin啊!

插件下载地址:http://ftp-nyc.osuosl.org/pub/jenkins/plugins/deploy/1.9/deploy.hpi
版本:1.9

插件地址:https://wiki.jenkins-ci.org/display/JENKINS/Deploy+Plugin

登录Jenkins
选择 Jenkins->系统管理->管理插件->高级 上传插件,选择deploy.hpi文件上传,上传完成后需要重新启动Jenkins
在插件管理的已安装标签下,可以看到“Deploy to container Plugin”,证明插件安装成功

2、配置job

build已经完成打war包功能,Deploy Plugin只是负责远程部署
在“构建后操作” 选择“deploy war/era to a container”
输入下面参数:
WAR/EAR files:war包路径
Context path:此处填写为访问路径,如应用访问路径取名为app,则部署成功后是:服务器地址:服务器端口/app(即Context path的值)
Container:下拉菜单,选择容器
Deploy on failure:未勾选,自己理解是当构建失败时也要发布

注意:WAR/EAR files项目需要有target/,就是构建的输出目录要带上。
可参考下图:
远程部署配置

部署结果:

远程部署成功

部署碰到个问题:
Jenkins控制台没有报任何错误,build也是成功的,但是就是未在远端服务器看到war包,查了资料,原来war包路径错误会导致部署失败,但是不会报错(猜想:因为此时已经build完成了,不属于build的范围,所以不会改变build结果)。

解决问题参考这个网址: http://stackoverflow.com/questions/9277223/jenkins-auto-deploy-tomcat-7

I was having the same problem, and in my case the (relative) path to the WAR file was incorrect. Apparently if you don’t have it exactly correct (it needs to be relative to the workspace root) then the deploy plugin will silently fail. In my case the path was:

target/whatever.war

Once that was fixed, I ran into a different problem in that the plugin expects to connect to the manager/text version of Tomcat Manager, rather than the manager/html version that I usually configure by default. You’ll need a line in your tomcat-users.xml file like the following:

(This is in addition to the “manager-gui” role you probably already have set up.)

Once those changes were made, the build and deployment worked just fine.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值