Install & configure Maven build tool on Jenkins

0 104
  1. Download maven packages https://maven.apache.org/download.cgi onto Jenkins server. In this case I am using /opt/maven as my installation directory – Link : https://maven.apache.org/download.cgi
     # Creating maven directory under /opt
    mkdir /opt/maven
    cd /opt/maven
    
    # downloading maven version 3.6.0
    wget https://archive.apache.org/dist/maven/maven-3/3.6.0/binaries/apache-maven-3.6.0-bin.zip
    unzip /opt/maven/apache-maven-3.6.0-bin.zip
  2. Setup M2_HOME and M2 paths in .bash_profile of user and add these to path variable
    vi ~/.bash_profile
    M2_HOME=/opt/maven/apache-maven-3.6.0
    M2=$M2_HOME/bin
    PAHT=<Existing_PATH>:$M2_HOME:$M2
  3. Logoff and login to check maven version Check maven version
    mvn –version
  4. Install maven plugin without restartManage Jenkins > Jenkins Plugins > available > Maven Invoker
  5. Configure java pathManage Jenkins > Global Tool Configuration > Maven

  6. Apply & Save

Leave A Reply

Your email address will not be published.