Tuesday, May 31, 2016

Install Maven on Linux or Unix system by command line

Steps to install Maven on Linux or Unix machine:

1. Open Maven binaries from link
2. Pick the latest one for 
Eg. http://mirror.olnevhost.net/pub/apache/maven/binaries/apache-maven-3.2.2-bin.tar.gz
3. Navigate to /usr/local/maven Type command 
  $ wget http://mirror.olnevhost.net/pub/apache/maven/binaries/apache-maven-3.2.2-bin.tar.gz
4. Type command to extract the tar file. 
   $ tar xvf apache-maven-3.2.2-bin.tar.gz
5. Add environment variable-
   export M2_HOME=/usr/local/maven/apache-maven-3.2.2
$ export M2=$M2_HOME/bin
$ export PATH=$M2:$PATH
6. Check if Maven is install by below command -
$ mvn -version

[EDIT-Install straight forward with single command]
sudo apt install maven