Jenkins WAR deployment

2019-07-26 17:37发布

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.

1条回答
我只想做你的唯一
2楼-- · 2019-07-26 17:58

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

查看更多
登录 后发表回答