Earlier, we had learnt How To Install Maven in Eclipse and then we learnt How To Create Maven Project in Eclipse. Today in this post, we are going to see How To Execute Maven Project Using Jenkins. To do this, we need to have the following
Firstly install Maven in Eclipse IDE and create a Maven Project. Next, open Jenkins and create a new Job to execute Maven Project using Jenkins.
Execute Maven Project Using Jenkins:
In this article, we see how to execute maven project using jenkins.
Click on New Item link to create a job on Jenkins
Enter an item name (here I am adding a name ‘MavenProject’) and click on FreeStyle Project and click on OK
Scroll down to ‘Build‘ option. Click on ‘Add Build Step‘ and choose the value ‘Invoke top-level Maven targets‘ from the drop down list.
Enter Goals “clean install”
Enter POM path (in my case the path is D:\STM\STMBlog\workspace\MavenProject\pom.xml)
Click on ‘Apply‘ and ‘Save‘
We have created a new project ‘MavenProject‘ with the configuration to execute Maven Project using Jenkins. You could see in the below screenshot.
Let’s execute it now. Click on ‘Build Now‘ button. It will invoke pom.xml.
Right click on Build Number (here in my case it is #1) and click on Console Output to see the result.
You could see Build Status ‘Success’ on Console Output.
This way, we could execute Maven Project using Jenkins. We could generate Extent Reports after the completion of execution. This we see in the next post.