VEDANT KONDE 221827
DEVOPS EXP: 05
Aim: To Deploy a application on an Apache Tomcat server using Jenkins
Theory:
Jenkins is an open-source automation server widely used for continuous integration and continuous
deployment (CI/CD). It helps automate the software development lifecycle by integrating various tools like
Git, Maven, and Tomcat.
In this setup:
Git acts as the version control system where the application source code is maintained.
Jenkins pulls the latest code from Git and builds it (e.g., using Maven to generate a WAR file).
Tomcat is an application server where the built artifact is deployed for execution.
The workflow enables:
1. Automation of Builds – Jenkins continuously pulls code and packages it.
2. Continuous Deployment – The packaged WAR file is automatically deployed on Tomcat.
3. Error Reduction – Manual deployment errors are minimized.
4. Faster Delivery – Development to deployment cycle time is reduced, improving productivity.
This integration of Git, Jenkins, and Tomcat ensures a streamlined CI/CD pipeline where every code change
can be quickly built, tested, and deployed.
Steps:
1. Install Apache Tomcat : https://tomcat.apache.org/download-90.cgi
Open Tomcat > Next > Agree > Set Port=7080, Username & Password > Next > Finish.
Check if tomcat is running: https://localhost:7080/
2. Install Jenkins: https://www.jenkins.io/download/
3. Create or Clone a Maven Project on Github. (https://github.com/22f3002244/DevOps)
4. Open Jenkins: https://localhost:8080 Go to Settings > Credentials
5. Select System > Global credentials
6. Click on add credentials:
Add your username
Add your password
ID = tomcat-creds
Description: Tomcat Manager credentials
Click on Create
7. Select New Item
8. Choose Pipeline
9. Under Configuration:
Go to Pipeline.
Choose Pipeline Script from SCM.
Choose SCM source as Git.
Keep the credential as none if the repository is public or add the credential details by clicking
on add.
Set branch to */Main
Then Click on Apply and Save
10. Click on Build Now
11. Check if the war file is generated inside the project-folder/taget-folder/*.war
C:\\.jenkins\workspace\pipeline\web\target
Check if the file name is showing in Tomcat Server under Applications Path Column:
https://localhost:7080/manager/html
If the filename is not there, then scroll down and add the war file manually under “war file to
deploy.”
12. Click on the war file name to open the application or directly search
https://localhost:7080/YOUR_WAR_FILE_NAME
Conclusion:
In this practical, we implemented a CI/CD pipeline using Jenkins, Maven, and Apache Tomcat. The pipeline
automated code checkout, build, testing, and WAR file generation for deployment. Unit tests ran
successfully, ensuring code stability, though a 404 error during deployment highlighted the need to verify
the context path. Overall, the exercise provided practical experience in automating builds, managing multi-
module Maven projects, and deploying web applications in a DevOps environment.