Jenkins — Create First Maven Job

Shiv Jalli
2 min readAug 30, 2020

--

This post will cover some of the basic aspects of a Maven Job in Jenkins.

Link to Github and let’s start.

Prerequisite

  1. The following instruction requires a “HelloWorld” Maven project in Github repository.

Create the Jenkins Job

From the browser Dashboard (initial) Jenkins page, click

New Item

Enter an item name

First-Maven-Project

select Freestyle Project and press Ok.

Discard old builds

✅ Discard old build

Select the repository

Github Repo: https://github.com/DaRealPunjabi/mavenapp
Branch: Master

Clean the workspace

✅ Delete workspace before build starts

Configure the build and click Save

Select: Invoke top-level Maven targetsMaven Version(Default): DefaultMaven
Goals: clean package
POM: HelloWorld/pom.xml

Build it

From the browser Project First Job page, click

Build Now

Examine the Job

Click the job, and select console output

Console Output

Test the build

Connect to GCP Jenkins server instance, using SSH run the following command in the terminal

cd /var/lib/jenkins/workspace/First-Maven-Project/HelloWorld/target/
java -jar HelloWorld-1.0-SNAPSHOT.jar
Hello World!

👏 First Maven job created.

--

--

Shiv Jalli

Simplicity is Beautiful. From its brilliancy, everything is illuminated.