Please make sure while deploying to the container, the container should be running. Also please follow the below steps to deploy to container:
Please follow the below steps for deploying the addressbook.war file to a tomcat container:
Deploy the war file ( Make sure that you have installed "Deploy to war" plugin)
- In the Source code management step select git and give Github repository URL
- In the build step select invoke top-level maven targets and give goal as package.
- In the post-build action, select deploy war/ear to a container and then select Tomcat 8 container
In the Tomcat URL, you have to specify the IP address of your machine and the port number on which tomcat is running.
Install and start the tomcat service and then you can access it from the browser(the port number you can find in server.xml file which will be under /opt/tomcat/conf directory).
Also for the manager username and manager password you have to edit the tomcat-users.xml file and create a user there and provide him some roles so that he has the permissions to edit the tomcat as a manager( you can provide him manager-gui, admin-gui, manager-script roles). You have to use the same user in your Jenkins job. In the post-build action step of the Jenkins job i.e. deploy war/ear to a container sellect tomcat 8.x container and add credentials. You have to give same credentials which you gave in the tomcat-users.xml file.
Click on add and add the credentials