Installing Maven 3 on Ubuntu 12.04

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

Open a terminal and execute the commands below.

  1. wget
  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: