For application deployment, we can utilize multiple ways to deploy an application in a web server or application server. We can use batch script or shell script to copy the package file created after a Continuous Integration process, or we can use a Jenkins plugin to deploy an application:
- Go to
Manage Jenkins
|Manage Plugins
and installDeploy to container Plugin
:
- Wait until the plugin is installed successfully:
- To allow deployment using the Jenkins plugin, go to the Tomcat installation directory and
open conf\tomcat-users.xml
. - Create a new role and new user as follows:
- Restart Tomcat.
- Create a new
Freestyle build
in Jenkins namedPetClinic-Deploy
.
- What we will do here is copy the artifact created from the
PetClinic-Package
job and deploy it in Tomcat. Install the Copy Artifact plugin to perform this action. Give the project a name and path from which we need to copy the WAR file:
- Give a path to the WAR file for deployment using the Jenkins plugin. Select...