This project demonstrates how to build a simple Java application using Maven in Jenkins.
It is designed as an introductory Continuous Integration (CI) example, running either locally or on a remote server (e.g., AWS EC2).
This repository contains:
- A basic Java
HelloWorld
application - A
pom.xml
file for Maven build configuration - Instructions to set up a Jenkins Freestyle job to build the application
The Jenkins job:
- Clones this repository from GitHub.
- Builds the project using Maven (
clean package
). - Optionally archives the generated
.jar
file as a build artifact.
hello-java-maven/ ├── pom.xml └── src └── main └── java └── HelloWorld.java
- pom.xml – Maven build configuration file
- HelloWorld.java – Simple Java class printing a message to the console
Before running this project in Jenkins, ensure you have:
- Java JDK (8 or 11 recommended)
- Maven (configured in Jenkins)
- Git (for cloning this repository)
- Jenkins (locally, Docker, or on AWS EC2)
- Docker (optional, if running Jenkins in a container)
git clone https://github.com/TechnicalGaur/hello-java-maven.git
cd hello-java-maven
docker run -d --name jenkins \
-p 8080:8080 -p 50000:50000 \
-v jenkins_home:/var/jenkins_home \
jenkins/jenkins:lts
Go to Manage Jenkins → Tools → Maven installations
Add Maven (e.g., Maven 3.x) and check Install automatically
New Item → Freestyle project → Name: hello-java-maven
Source Code Management:
-Select Git
-Repository URL:
https://github.com/TechnicalGaur/hello-java-maven.git
Branch Specifier: */main (or */master if using master branch)
Build → Invoke top-level Maven targets:
Maven Version: Maven 3.x
Goals: clean package
Post-build Actions (Optional):
Archive artifacts: target/*.jar
Click Build Now
Open the console output to verify BUILD SUCCESS
Download the .jar artifact if archived
This project is released under the MIT License.
Prashant Gour 🔗 GitHub: TechnicalGaur



