Deploying a WAR file from Jenkins to Tomcat
For application deployment, we can multiple methods to deploy an application to a web server or application server. We can use a batch script or shell script to copy the Package file created after the Continuous Integration process, or we can use the Jenkins plugin to deploy an application.
Getting ready
Go to Manage Jenkins
| Manage Plugins
and install Deploy to container Plug
in
:

Wait until the plugin has installed successfully.
How to do it...
To allow using the Jenkins plugin, go to the Tomcat installation directory and open conf\tomcat-users.xml
.
- Create a new role and a new user, as follows:

- Restart Tomcat.
- Create a new Freestyle build in the Jenkins named
PetClinic-Deploy
. - What we will do here is copy the artifact created for the
PetClinic-Package
job and deploy it in Tomcat. Install the Copy Artifact plugin to perform this action. Give theProject name
and path from which we need to copy the WAR file:

- Give the path to the WAR file for using the...