Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

sandydan-dev/SampleWebApp

Open more actions menu
 
 

Repository files navigation

Java Web Application CI/CD Pipeline Using Jenkins (Windows Environment)

This project demonstrates a complete CI/CD pipeline for automating the build, test, and deployment process of a Java web application using Jenkins, Ant, JUnit, Tomcat, and GitHub — entirely on a Windows environment.


🚀 Tech Stack Used

  • Java (JDK 21)
  • Apache Ant – Build tool for generating WAR file
  • JUnit – Unit testing framework
  • Apache Tomcat 9 – Deployment server
  • Git & GitHub – Source code management
  • Jenkins – CI/CD automation

📂 Project Structure

The Java project contains a pom.xml and a standard Ant build.xml file used to compile and package the application into a .war file.


📌 Jenkins CI/CD Pipeline Overview

The pipeline consists of four connected Jenkins jobs, each with a specific responsibility.

### 1️⃣ First Job – Source Code Checkout

  • Pulls code automatically from GitHub repository
  • Uses Poll SCM to trigger builds on code changes
  • Cleans workspace and fetches latest commit

2️⃣ Second Job – Build & Quality Check

  • Runs Ant build commands
  • Compiles Java source files
  • Creates output directory and generates the WAR file
  • Performs basic quality checks

3️⃣ Third Job – Testing (JUnit)

  • Executes JUnit test cases
  • Fails the job automatically if any test case fails
  • Publishes JUnit test results in Jenkins dashboard

4️⃣ Fourth Job – Deployment to Tomcat

  • Deploys the generated WAR file to a local Tomcat server
  • Uses the Jenkins Deploy to Container plugin
  • Tomcat Manager credentials are configured in Jenkins
  • WAR deployed using the Tomcat Manager /manager/html API

🔄 Job Chaining (Build Flow)

The jobs run in sequence: GitHub → FirstJob → SecondJob → ThirdJob → FourthJob → Tomcat

  • If any job fails, the pipeline stops.
  • If all jobs succeed, the updated web application is deployed to Tomcat.

⚙️ Windows Environment Setup

Software Installed

  • Java JDK
  • Apache Ant
  • Apache Tomcat
  • Git for Windows
  • Jenkins (Windows Installer)

Environment Variables Set

JAVA_HOME ANT_HOME CATALINA_HOME PATH (added git, ant, java)


✔ Final Output

A fully automated CI/CD pipeline that:

  1. Downloads latest code
  2. Builds WAR file
  3. Runs tests
  4. Deploys to Tomcat

All with one pipeline execution.


📎 Screenshots (Optional)

  • Jenkins Jobs

  • 1_jenkins
  • Build History

  • 2_build_pipeline
  • JUnit Reports

  • 3_deliver_pipeline
  • Tomcat Deployment Status

  • 4_build_war_file

🤝 Contributions

Feel free to fork this project and improve it!


CICD Pipeline

             +-----------------------+
             |     GitHub Repo       |
             |  (SampleWebApp.git)   |
             +-----------+-----------+
                         |
                         | Poll SCM
                         v
             +-----------------------+
             |     Jenkins Job 1     |
             |     FIRSTJOB          |
             |  Clone from GitHub    |
             +-----------+-----------+
                         |
                         | Trigger
                         v
             +-----------------------+
             |     Jenkins Job 2     |
             |     SECONDJOB         |
             | Build .war via ANT    |
             +-----------+-----------+
                         |
                         | Trigger
                         v
             +-----------------------+
             |     Jenkins Job 3     |
             |      THIRDJOB         |
             |  Run JUnit tests      |
             +-----------+-----------+
                         |
                         | Trigger
                         v
             +-----------------------+
             |     Jenkins Job 4     |
             |     FORTHJOB          |
             | Deploy WAR to Tomcat  |
             +-----------+-----------+
                         |
                         v
             +-----------------------+
             |    Apache Tomcat      |
             |   Running WAR App     |
             +-----------------------+

📬 Contact

For queries, reach out on LinkedIn 😊

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • HTML 83.5%
  • Java 16.5%
Morty Proxy This is a proxified and sanitized view of the page, visit original site.