shell - Jenkins war 部署

标签 shell maven tomcat deployment jenkins

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

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.

以下是我的 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 文档将 tomcat 用户角色定义为 manager-gui 和 manager-script 以及 manager-jmx,即从 Tomcat 6.0.30 开始,使用管理器应用程序所需的角色已从单个管理器角色更改为 以下四个角色。

  • 管理器-gui
  • 管理脚本
  • 经理-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 命令“复制”war。使用 Jenkins 部署应用程序 Deploy plugin它将简化您的流程。

关于shell - Jenkins war 部署,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29829960/

相关文章:

maven - GAE Maven如何部署

Eclipse 中的 Java EE 模块依赖项页面缺少项目

eclipse - 如何在 Eclipse 中运行/调试 Java Web 服务项目

arrays - 将 grep 输出存储在数组中

java - 在 Windows 上使用 Cygwin 排序时出现 "Input file specified two times."错误

java - 将应用程序安装到 Tomcat7 中以与 sonarqube 4.1 一起运行(maven 插件)

Java Servlet 登录过滤器排除列表不适用于整个文件夹

linux - 在 bash 脚本中删除基于名称作为日期的文件夹在 mm/dd/yy 中

perl - 如何拆分一条线并重新排列其元素?

java - 添加自定义 Maven 项目作为依赖项