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.
- 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
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.
The pipeline consists of four connected Jenkins jobs, each with a specific responsibility.
- Pulls code automatically from GitHub repository
- Uses Poll SCM to trigger builds on code changes
- Cleans workspace and fetches latest commit
- Runs Ant build commands
- Compiles Java source files
- Creates output directory and generates the WAR file
- Performs basic quality checks
- Executes JUnit test cases
- Fails the job automatically if any test case fails
- Publishes JUnit test results in Jenkins dashboard
- 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/htmlAPI
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.
- Java JDK
- Apache Ant
- Apache Tomcat
- Git for Windows
- Jenkins (Windows Installer)
JAVA_HOME ANT_HOME CATALINA_HOME PATH (added git, ant, java)
A fully automated CI/CD pipeline that:
- Downloads latest code
- Builds WAR file
- Runs tests
- Deploys to Tomcat
All with one pipeline execution.
Feel free to fork this project and improve it!
+-----------------------+
| 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 |
+-----------------------+
For queries, reach out on LinkedIn 😊