This site has been archived and will no longer be updated.
You can find my new profile at neilpahl.com. My new blog is at 808.ninja.
Tue, 01 May 2012:
Since Ubuntu 10.04 has only maven2 in the apt-get repositories, maven 3 must be downloaded, extracted and added to the $PATH environment variable.
First, download the the binaries from the maven download page. I would give the download link, but they ask that you download from the nearest mirror (I'm in Hong Kong, and downloaded binaries for Maven 3.0.4) . So, copy the download link for your nearest mirror and then use:
wget http://link/to/download/maven_binaries.tar.gz
unzip them,
tar xzf maven_binaries.tar.gz
move the files to /usr/local (the recommended place to place non-package managed linux installs)
sudo cp maven_binaries /usr/local/apache-maven
then add some evirontment variables to /etc/environment:
JAVA_HOME="/usr/lib/jvm/java-6-openjdk" M3_HOME="/usr/local/apache-maven" MAVEN_HOME="/usr/local/apache-maven" M3="/usr/local/apache-maven/bin"
append the maven binaries to $PATH by changing your PATH from :
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games"
to:
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/apache-maven/bin/"
afterwards, run the following to test:
mvn --version
you should get something like:
Apache Maven 3.0.4 (r1232337; 2012-01-17 16:44:56+0800) Maven home: /usr/local/apache-maven Java version: 1.6.0_20, vendor: Sun Microsystems Inc. Java home: /usr/lib/jvm/java-6-openjdk/jre Default locale: en_HK, platform encoding: UTF-8 OS name: "linux", version: "2.6.32-40-generic-pae", arch: "i386", family: "unix"