Setting Up Jenkins Pipeline for a Spring Boot App (Step 1)

Morris Muriuki Muthigani
54
2
laravel

07/27/2023 (11 months ago)


Learn to install and configure Jenkins on the local machine. Also, learn to setup a Jenkins pipeline and configure job steps for a Spring boot application including executing the unit tests and archiving the old builds.


1. Creating a Spring Boot Application

Spring Boot is a java-based framework developed by the Pivotal team to create stand-alone, production-grade application. Spring boot is also used to develop applications based on microservices architecture where multiple services run independently and are loosely coupled with each other.

In this tutorial, we are using the application developed for Spring boot hello world example.


2. Setting Up Jenkins

2.1. Installing Jenkins

We can go to the Jenkins download link: https://www.jenkins.io/download/ and download the package suitable for your operating system.

Once the package is downloaded, double-click on it to start installing and follow the below steps:

Double-click the installer and click Next.

Choose the directory where we want to install Jenkins and click Next.

Next, select the “Logon Type” as “Run service as LocalSystem” which will grant Jenkins full access to our machine and services. Click on Next to continue.

The next step is port selection. We can specify any HTTP port and click on Test Port to check if the port is available or not. We have used port 9090.

If the mentioned port is available, then we will see a “Green Tick” beside the “Test Port” button like below. Click on Next to continue.

If we have downloaded the latest version of Jenkins, we need to have java 11 or 17 installed. If we don’t have the required version, we need to install it else we have to select the path of the JDK in the system and click Next.

We don’t have to do anything in this step; simply click Next to continue. We are testing locally, so firewall selection can be omitted.
Finally, click on Install to complete the installation process. It may take some time to complete the installation.
Once the installation is completed, we will see this page; now we click on Finish and are done with the installation.
2.2 Configuring Jenkins
Once Jenkins is installed, Let’s open a browser and go to http//localhost:9090/ or whatever port we used while installing. We will see a web page something like this –
On this page, we need to specify a temporary administrative password, to get the password go to the path mentioned in the browser. In my case, it is,
Copy and paste the password in the password field and click on Continue. On the next page, we will see something like this-
Here we click on “Install suggested plugins” to let Jenkins download and configure some necessary plugins for us. We wait till the download is completed, this may take a while.
Once the download is completed, we click on Continue. The next step is where we need to create an admin user, which we will use while login into Jenkins.
Let’s fill out the form, and remember the username and password, as these will be our admin credentials, and click Save and Continue.
In the next step, we will be asked if you want to change the URL, but don’t change anything click Continue and then click Finish to complete the Jenkins configuration.

2.3. Install Maven Plugin
Once we are done with the initial Jenkins configuration, we should land on the Jenkins home page –
Click on the “Manage Jenkins” option on the left side of the screen. Then we should see something like this on your screen –
Next, we click on the “Manage Plugins” option to install/remove/view the plugins.
Under Manage plugins we click on “Available Plugins” and search for the “Maven Integration” plugin. We selected the option shown in the screenshot below. Then we click on the “Install without restart” button.
 Once the downloading starts we will see something like this –
We will wait for the processes to complete. Optionally if we want we can select the option “Restart Jenkins when installation is complete and no jobs are running”.
Now go to Jenkins Dashboard -> Manage Jenkins -> Global Tool Configuration.
Under this scroll down and we find a section for Maven. We click on the Add Maven button. Under Name, we mention a unique name, uncheck “Install automatically” and in the MAVEN_HOME section mention the path to the location of maven installed in our system, and click on Save.
We can also add multiple versions of maven by specifying a unique name for each one of them.

2.4. Installing the Git Plugin
The next step involves installing Git plugin. Jenkins installs the plugin in the initial configuration. From the Jenkins Dashboard, go to Manage Jenkins -> Manage Plugins -> Installed Plugins and search for “GIT”, we should have a bunch of git plugins already installed, If it is not available, then we need to install it the way we installed the Maven Plugin.
Happy Learning !!


Discussion (2)

Noob master's avatar
medranostarckuzz8n0+6pj5170gq4ih@gmail.com 6 days ago
qui qui eos delectus id est omnis dolores qui est distinctio odio rerum voluptate expedita ex aut quisquam ut id. illum aut iure voluptate saepe non et omnis. minima vel consequatur dolorem fugit vita
Noob master's avatar
Cero_ibEl 10 months ago
A2 Hosting: A2 Hosting is known for its high-speed performance and excellent customer support. They provide various hosting options, including shared, VPS, and dedicated hosting, along with free site migration. DreamHost: DreamHost is a well-established hosting provider, known for its solid uptime and fast-loading websites. They offer a wide range of hosting options, including shared, VPS, and dedicated hosting. [url=http://webward.pw/]http://webward.pw/[/url].

Recent Blogs

Our Recent Blogs