Must already have a jdk installed. In my case: java-7-oracle.
Open a terminal and execute the commands below.
- wget http://apache.petsads.us/maven/maven-3/3.0.4/binaries/apache-maven-3.0.4-bin.tar.gz
- tar -zxf apache-maven-3.0.4-bin.tar.gz
- sudo cp -R apache-maven-3.0.4 /usr/local
open the ~/.profile and add the following lines:
- PATH=”$M2:$PATH”5. Save the file and re-log to load the new environment variables.
- Make sure that java is in your path. This should have been done while setting up a jdk.
- 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.