Deployment Of Spring Boot Application In Jenkins (original) (raw)

Last Updated : 23 Jul, 2025

In this article, we will be exploring how to automate the process of building Spring Boot applications by employing a polling trigger. We will also learn how to generate reports and store artifacts in the process. To achieve this, we will be leveraging the Jenkins server. Our goal is to create a pipeline and write a script that will run every minute to detect any commits that are pushed to our GitHub repository.

**What Is A Spring Boot?

**Spring Boot is a framework that is built using Java programming language. Although it can perform all the functions of the Spring Framework, it stands out for its autoconfiguration (automatically change configurations based on dependencies), shorter code length, user-friendliness, stand-alone nature (can run by itself using embedded servers), and opinionated nature (install only the dependencies you require). It is widely used to develop Java applications.

**What Is Jenkins?

Jenkins is a automation tool used for Continuous Integration (CI) to automate, manage, and control software delivery at different stages such as build, testing, and deployment.

Deploying Spring Boot Application In Jenkins: A Step-By-Step Guide

Step 1: Downloading Jenkins

download jenkins.war file

Note: You should have Java 11 or Java 17 to run the current jar downloaded.

**Step 2: Starting The Jenkins

java -jar jenkins.war

capture password from logs

Installing Suggested Plugins

Creating Admin User

Instance Configuration

Jenkins Dashboard

**Step 3: Downloading Required Plugins

Click on **Manage Plugins -> Under system configuration Click **Plugins -> **Available plugins

Navigate to Manage Plugins

Manage Jenkins

Navigating to  available-plugins

Installing Jenkins Plugins

**Step 4: Creating A Pipeline

creating pipeline

Adding Github repository in Jenkins job

poll SCM configuration

**Note: We are running Jenkins on windows machine so my command will be having **bat as prefix instead of **sh (MacOS).

pipeline {

agent any

stages {

stage('checkout') {

steps {

git branch: 'master', url: 'https://github.com/programenth/spring-boot-jenkinsArt'

}

}

stage('build') {

steps {

bat './gradlew build'

}

}

stage('capture') {

steps {

archiveArtifacts '**/build/libs/*.jar'

junit '**/build/test-results/test/*.xml'

// Configure Jacoco for code coverage

jacoco(execPattern: '**/build/jacoco/*.exec')

}

}

}

post {

always {

// Clean up workspace

cleanWs()

}

success {

// Notify on success

echo 'Build successful!'

}

unstable {

// Notify on unstable build

echo 'Build unstable.'

}

failure {

// Notify on failure

echo 'Build failed!'

}

}

}

Understanding Of Script

pipeline-script

Step 5: Triggering Pipeline

build pipeline manually

edit-readme

commit-readme

automate-build