Configuring maven in Jenkins for your java project

In Last two posts we covered setting up Jenkins and Configuring git in Jenkins, if you missed it, checkout below links:

Now let us see how we can setup and configure maven in jenkins:

Step 1: First make sure maven is installed in your pc, for that opem CMD and type $ mvn -v for maven version

If it is not installed then install it from here and add the MAVEN_HOME as C:\Apps\apache-maven-3.5.0 and add bin in path like C:\Apps\apache-maven-3.5.0\bin

Step 2: Configure maven in the Jenkins

Click “Manage Jenkins”

Then click on “Global tool configuration”

Make sure your JDK installed in your system is configures as below

Then Add maven as below and click save:

Step 3: Install maven integration plugin

restart the jenkins after installation

Now we can create maven project based JOB

Click on New Item to create a new JOB and enter the name of job and select maven project as template

add the SCM repo url

add the build step – pom path and goal

Save the job and build the project now

Check the console output and see the logs and wait until it is build success

Hence the maven setup and app build is completed!


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s