Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
26 views2 pages

Jenkins to Tomcat Deployment Guide

This document provides steps to deploy a war file from a Jenkins job to a Tomcat server: 1. Install the Deploy to Container plugin in Jenkins. 2. Edit the tomcat-users.xml file on the Tomcat server to add a user with manager-script role for remote deployments. 3. Configure the Jenkins job to deploy the war file to Tomcat after building, specifying context path, Tomcat version, credentials, and Tomcat URL. 4. Run the Jenkins job and check the logs to verify successful deployment to Tomcat.

Uploaded by

Murali Tunga
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
26 views2 pages

Jenkins to Tomcat Deployment Guide

This document provides steps to deploy a war file from a Jenkins job to a Tomcat server: 1. Install the Deploy to Container plugin in Jenkins. 2. Edit the tomcat-users.xml file on the Tomcat server to add a user with manager-script role for remote deployments. 3. Configure the Jenkins job to deploy the war file to Tomcat after building, specifying context path, Tomcat version, credentials, and Tomcat URL. 4. Run the Jenkins job and check the logs to verify successful deployment to Tomcat.

Uploaded by

Murali Tunga
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

Deploying your war file from Jenkins to Tomcat

Step 0. Prerequisites

For the next steps I assume that you already have Tomcat up and running, you also have Jenkins up
and running, have administrator privileges, and you have set up a job in Jenkins that produces a war
file.

Step 1. Install Jenkins plugin

Open your favorite browser and navigate to Jenkins. Log in and select “Manage Jenkins” followed by
“Manage Plugins”. Select the “Available” tab, locate the “Deploy to container” plugin and install it.

Step 2. Edit tomcat-users.xml

In order for Tomcat to accept remote deployments, you have to add a user with the role manager-
script. To do so, edit the file ../conf/tomcat-users.xml and add the following line:

<?xml version='1.0' encoding='utf-8'?>

<tomcat-users>

<role rolename="manager-gui"/>

<user username="tomcat" password="Tomcat" roles="manager-gui, manager-script, manager-script,


manager-status"/>

</tomcat-users>

Step 3. Edit the Jenkins job


Back in Jenkins, go to your job and select “Configure”. Next, scroll down to the bottom of the page to
the “Post-build Actions”. Select the option “Deploy war/ear to a container” from the “Add post-build
action” dropdown button. Fill in the new fields, e.g.:

For WAR/EAR files you can use wild cards, e.g. **/*.war.

The context path is the context path part of the URL under which your application will be published in
Tomcat.

Select the appropriate Tomcat version from the Container dropdown box (note that you can also
deploy to Glassfish or JBoss using this Jenkins plugin).

For the manager’s user name and password just copy over what you’ve entered in the tomcat-
users.xml file.

The Tomcat URL is the base URL through which your Tomcat instance can be reached.

Finally, don’t forget to save the configuration.

Step 4. Run the Job project and verify the end results

Schedule a build for your job in Jenkins. If you check out the log file you should see one or more lines
near the end indicating that the war file has been deployed

You might also like