Table of Contents
Goal
Goal of this project to Deploy Jenkins Pipeline to Build and Deploy Java Application
Pre-Requisites
- Create AWS EC2 Instance to configure Build environment
- Create AWS EC2 Instance to configure Apache Tomcat application server environment
- Migrate Java Source Code to your own repository
Server Configuration
- Login to Build server and configure the Build environment with below packages
- Install and setup Apache Maven, JDK 11, Git, Jenkins
- Login to App server and configure the App environment with below configuration
- Install Apache Tomcat 8.x
- Create Tomcat Users to access the Manager Application with Admin access for UI and Script based access
Jenkins Pipeline
Jenkins Configuration
- Install Plugins
- Copy Artifact
- Deploy to Container
- Add Credentials
- Add Bitbucket credentials to Credentials store
- Add Tomcat App credentials to Credentials store
Build
- Create Freestyle Build Job with below steps
- Clone the Java Source Code from Bitbucket repo Master branch
- Build the source using mvn package command
- Archive the Artifacts
- Configure Post-Build Actions to build other projects (Deploy Job)
- Enable Jenkins remote build execution with secure token
- Configure Bitbucket repository with webhook URL
Deploy
- Create Freestyle Deploy Job with below steps
- Copy Artifact from Build Job (Copy Artifact Plugin)
- Deploy Artifact to Tomcat App server (Deploy to Container Plugin)
Validation
- Commit a change to Bitbucket repository and verify if the webhook is invoked and Jenkins Pipeline is executed to Build and Deploy the Artifact to App server.
- Verify if you are able to access the application from public internet browser.
Still not confident, repeat the steps again. Good Luck!
© Edwiki Trainings – Click HERE If you are interested to learn more on Cloud & DevOps stack.