Installing Maven from Scratch

The following commands install Maven from scratch. However the version and URL of the tar-ball may change, in which case you should refer the official download page in order to get the current values for those items.

mkdir -p ~/bin
cd ~/bin
export MVN_VERSION=3.2.5
tar zxvf apache-maven-${MVN_VERSION}-bin.tar.gz

cat >> ~/.bash_profile << EOF
export PATH

. ~/.bash_profile
mvn -version

NOTE: The very first time you run Maven to build an artifact, it will download and cache its dependencies from the web, so that first time will produce a lot of output. The dependecies are cached in ~/.m2/repository and so after the first build things will go much faster.