詹金斯 WAR 部署
Jenkins WAR deployment
我正在尝试使用 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 6.0.30 之后的 Tomcat 文档将 tomcat 用户角色定义为 manager-gui 和 manager-script 以及 manager-jmx,使用 manager 应用程序所需的角色是从单一的经理角色转变为
以下四个角色。
- 管理器-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 命令中做错了什么导致授权异常。
不要 "copy" war 使用 curl 命令。使用 Jenkins 部署应用程序 Deploy plugin 它将简化您的流程。
我正在尝试使用 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 6.0.30 之后的 Tomcat 文档将 tomcat 用户角色定义为 manager-gui 和 manager-script 以及 manager-jmx,使用 manager 应用程序所需的角色是从单一的经理角色转变为 以下四个角色。
- 管理器-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 命令中做错了什么导致授权异常。
不要 "copy" war 使用 curl 命令。使用 Jenkins 部署应用程序 Deploy plugin 它将简化您的流程。