Hackforge Academy

Category: java

Creating a Jenkins Job

Published on 13 Aug 2026

Explanation

A Jenkins Job defines the steps Jenkins should execute to build, test, and package an application. A Freestyle project can be configured with a Git repository, Maven commands, build triggers, and post-build actions.

Code:

Jenkins Dashboard
→ New Item
→ Freestyle Project
→ Configure Git
→ Build Steps
→ Save
→ Build Now

Explanation

Jenkins can use Maven to compile, test, and package Spring Boot applications. Maven can be configured as a Jenkins tool or executed directly from the build environment.

Code:

mvn clean test
mvn clean package

# Jenkins Build Step
mvn clean package

Explanation

Jenkins can clone source code directly from a Git repository. Configure the repository URL, credentials, branch, and source code management settings so Jenkins can retrieve the latest application code.

Code:

Repository URL:
https://github.com/example/student-api.git

Branch:
*/main

Explanation

Build triggers determine when Jenkins should start a job. A job can be triggered manually, periodically, after another job, or automatically when a developer pushes changes to Git.

Code:

Build Triggers:

Build periodically
Poll SCM
GitHub hook trigger
Build after another project

Explanation

A Git webhook sends an HTTP notification to Jenkins whenever code is pushed to the repository. Jenkins receives the event and automatically starts the configured build, creating a continuous integration workflow.

Code:

Developer
   ↓
git push
   ↓
GitHub Webhook
   ↓
Jenkins
   ↓
Maven Build
   ↓
Test

🚀 Learn Spring Boot with real-world projects

💡 Build REST APIs step by step

🧠 Improve backend development skills

🎯 Get career-ready practical training

Join Our Free WhatsApp Community

Direct access to niche-specific mentors and peers on WhatsApp.

🐍

Python Community

Discuss Django, FastAPI, AI integration, and automation scripts with 15k+ developers.

Join Python Community
⚛️

React Community

Master Next.js, Framer Motion, and State Management. Share your latest UI components.

Join React Community

Java Community

Deep dives into Spring Boot, Microservices architecture, and high-performance backend ops.

Join Java Community