Installing Maven 3 on Ubuntu 12.04


Prerequisites:
Must already have a jdk installed. In my case: java-7-oracle.

Open a terminal and execute the commands below.

  1. wget http://apache.petsads.us/maven/maven-3/3.0.4/binaries/apache-maven-3.0.4-bin.tar.gz
  2. tar -zxf apache-maven-3.0.4-bin.tar.gz  
  3. sudo cp -R apache-maven-3.0.4 /usr/local
  4. open the ~/.profile and add the following lines:

  5. M2_HOME=”/usr/local/apache-maven-3.0.4”

  6. M2=”$M2_HOME/bin”
  7. PATH=”$M2:$PATH”5. Save the file and re-log to load the new environment variables.
  8. Make sure that java is in your path. This should have been done while setting up a jdk.
  9. mvn –version  to verify maven.**

I’ve recently found that depending upon your ubuntu flavor, that the .profile file may not be used. Instead the .bashrc file may get loaded. I’ve seen this in Lubuntu (LXDE) and Bodhi (Enlightenment). The process is the same, just add the files to the ~/.bashrc instead.
Download Mirrors:
http://www.apache.org/dyn/closer.cgi/maven/maven-3/3.0.4/binaries/apache-maven-3.0.4-bin.tar.gz

Sources:
http://java.dzone.com/articles/installing-maven-304-ubuntu

https://help.ubuntu.com/community/EnvironmentVariables

http://maven.apache.org/download.htmlhttp://maven.apache.org/download.html**