Jenkins WAR部署 [英] Jenkins WAR deployment

查看:172
本文介绍了Jenkins WAR部署的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用shell命令将WAR从Jenkins部署到tomcat6.0.39服务器,但无法部署并引发授权错误:

401未经授权

您无权查看此页面.如果您尚未更改任何配置文件,请检查该文件 安装中的conf/tomcat-users.xml.该文件必须包含 凭据,使您可以使用此Web应用程序.

以下是我的shell命令:

curl -T $WORKSPACE/target/myapp-1.0-RC1.war 'http://serverIP:8080/manager/deploy?update=true&path=/myapp'-u username:password

但是,以上命令在我的tomcat 6.0.24中正常工作.根据Tomcat 6.0.30及以后的tomcat文档,我确实将tomcat用户角色定义为manager-gui,manager-script和manager-jmx,将使用manager应用程序所需的角色从单个manager角色更改为 以下四个角色.

  • manager-gui
  • 管理脚本
  • manager-jmx
  • 经理状态

以下是我的tomcat-users.xml内容:

<tomcat-users>
 <user username="managergui" password="tomcatManager" roles="manager-gui"/>
  <user username="manager" password="tomcatManager" roles="manager-script"/>

我在tomcat-users.xml或我的shell命令中正在做什么,这会导致授权异常.

解决方案

不要使用curl命令复制"战争.使用Jenkins 部署插件部署应用程序,它将简化您的过程. >

I am trying to deploy WAR from Jenkins to tomcat6.0.39 server using shell command but it is unable to deploy and throwing Authorization error:

401 Unauthorized

You are not authorized to view this page. If you have not changed any configuration files, please examine the file conf/tomcat-users.xml in your installation. That file must contain the credentials to let you use this webapp.

Following is my shell command:

curl -T $WORKSPACE/target/myapp-1.0-RC1.war 'http://serverIP:8080/manager/deploy?update=true&path=/myapp'-u username:password

However the above command works fine with my tomcat 6.0.24. I did define tomcat user role as manager-gui and manager-script and manager-jmx as per tomcat documentation that Tomcat 6.0.30 onwards, the roles required to use the manager application were changed from the single manager role to the following four roles.

  • manager-gui
  • manager-script
  • manager-jmx
  • manager-status

Following is my tomcat-users.xml content:

<tomcat-users>
 <user username="managergui" password="tomcatManager" roles="manager-gui"/>
  <user username="manager" password="tomcatManager" roles="manager-script"/>

Whats wrong I am doing in tomcat-users.xml or in my shell command which is leading to Authorization exception.

解决方案

Don't "copy" the war with a curl command. Deploy the application with Jenkins Deploy plugin it will simplify your process.

这篇关于Jenkins WAR部署的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆