Jenkins Integration with Github and Maven

Nitish Singla
3 min readOct 28, 2020

In this blog, we are going to learn how to integrate Jenkins with Github and Maven.

The following are the topics we are going to discuss:

· Creating a Maven Project in Eclipse

· Installing Plugins for Github and Maven

· Integrating Jenkins with Github

· Integrating Jenkins with Maven and Creating the build of a Maven Project

Creating a Maven Project

I am going to show you how to create a Maven Project in Eclipse.

Go to File → New → Project → Maven Project. Enter Group ID and Artifact ID.

Now create a class in Maven Project. Right Click on your Maven Project on the left side by the name same as your artifact ID. Then click on New à Class. Enter the class name and write a program in Java. Refer to the pic as below (I have created a Class called Myclass in a Maven Project named CICD-Lab1.

Now again right click on your Maven Project on the left side and open pom.xml as show below.

Add required dependencies and plugins in pom.xml and save it.

You have successfully created your first Maven project on Eclipse.

Adding the Maven Project on Github

Add this Maven Project on Github using anyway you want. You can add it on Github using Command Prompt, Eclipse, Git Bash or drag the contents directly on github.

Now go to start Jenkins on your machine using java -jar jenkins.war and go to https://localhost:8080. (For more information on downloading and starting Jenkins, Refer to my other blog on medium “Getting started with Jenkins”).

Go to Manage Plugins and Download the Plugins for Github and Maven. Refer to the pic below.

Creating the Build of the Maven Project using Jenkins

Now Click on New Item → Maven Project.

Now under Source Code Management Tab. Click on Git and enter the github url where you have added your Maven project.

Now go to Build Tab and Enter the location of pom.xml present in the Github Repository and write Maven Goal “install” to create build of the Maven Project.

Click on Apply → Save.

Now Click on Build Now.

Now here it is. Build Success.

The Build of the Project is successfully created.

You can see the JAR file created in the target folder.

--

--