Pages

Wednesday 29 November 2017

Install and configure Maven on Ubuntu

This blog covers one alternative to install and configure Maven in Ubuntu. If you are facing some issue during installation by command line then go with below steps-

Step 1 : Navigate to  https://maven.apache.org/download.cgi and download the available version of Apache build tool apache-maven-3.5.2-bin.tar.gz file for Ubuntu


Select the binary distribution to download.


Step 2 : After successful download, place the downloaded file in your desired location directory and extract the same

Step 3 :Add maven in environment path : Open the terminal and run the following commands to set the environment variables (make sure you are providing right directory path where your maven available )

$ export M2_HOME=/usr/local/apache-maven/apache-maven-3.3.9

$ export M2=$M2_HOME/bin

$ export MAVEN_OPTS=-Xms256m -Xmx512m

with M2_Home path corresponding with the location of your extracted Maven files.
Now append the M2 variable to the system path:
$ export PATH=$M2:$PATH

Finally, verify if Maven has been added by running:
$ mvn -version

If this command showing maven version then every thing fine. Enjoy :)