Pages

Saturday 16 December 2017

Run Maven Project Using Jenkins

   Hi Friends,

   In this blog we will see how we can configure a Maven project in Jenkins on Ubuntu. If you are using other OS the don't worry. process is same for all.

    Prerequisites :

  1. Make sure you have successfully installed Java and all path are set
Open terminal and run the commands :

     echo $JAVA_HOME

     Java -version 


   2. Make sure you have successfully installed Maven on your system and maven home path is set in system path.
       
   Open terminal and use below commands to check whether maven installed on the system and all path are set

  ●     echo $M2_HOME
  ●     Mvn -v



   3. Make sure you have successfully installed Jenkins with all required plugins for Maven project

Plugin for Maven project
  ●  Maven Integration plugin
  ●  Maven Invoker plugin
  ●  Config File Provider Plugin

After successful installation just cross verify weather all things are set up.  start Jenkins > open Jenkins homepage > click New Item.
You will see here Maven Project to create a Jenkins Job with maven project configuration as shown below


    4. Now setup the java and maven path in Jenkins

       Go to Manage Jenkins > Global Tool Configuration and set MAVEN_HOME
       and JAVA_HOME



    5. Configure your pom.xml in Jenkins Job

     I. Navigate your project directory structure and copy the complete path till pom.xml e.g. in my case its           

 /home/narendra/workspace/RContactsWeb/pom.xml

    II. Now create a new job > Select Maven Project and enter the pom.xml 
        path here :




       After successful configuration > build the project. for status you can check console output 

No comments:

Post a Comment