Book Image

Jenkins Essentials - Second Edition

By : Mitesh Soni
Book Image

Jenkins Essentials - Second Edition

By: Mitesh Soni

Overview of this book

<p>In agile development practices, developers need to integrate their work frequently to fix bugs or to create a new feature or functionality. Jenkins is used specifically for Continuous Integration, helping to enforce the principles of agile development. This book focuses on the latest and stable release of Jenkins (2.5 and later), featuring the latest features, such as Pipeline as Code, the new setup experience, and the improved UI. With the all-new Pipeline as Code feature, you will be able to build simple or advanced pipelines easily and rapidly, hence improving your teams' productivity.</p> <p>This book begins by tackling the installation of the necessary software dependencies and libraries you'll need to perform Continuous Integration for a Java application. From there, you'll integrate code repositories, applications, and build tools for the implementation of Continuous Integration.</p> <p>Finally, you will also learn how to automate your deployment on cloud platforms such as AWS and Microsoft Azure, along with a few advanced testing techniques.</p>
Table of Contents (17 chapters)
Title Page
Credits
About the Author
About the Reviewers
www.PacktPub.com
Customer Feedback
Dedication
Preface

Deploying a war file from Jenkins to Tomcat


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:

  1. Go to Manage Jenkins | Manage Plugins and install Deploy to container Plugin:
  1. Wait until the plugin is installed successfully:
  1. To allow deployment using the Jenkins plugin, go to the Tomcat installation directory and open conf\tomcat-users.xml.
  2. Create a new role and new user as follows:
  1. Restart Tomcat.
  2. Create a new Freestyle build in Jenkins named PetClinic-Deploy.
  1. 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:
  1. Give a path to the WAR file for deployment using the Jenkins plugin. Select...