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
wget http://mirrors.sonic.net/apache/maven/maven-3/${MVN_VERSION}/binaries/apache-maven-${MVN_VERSION}-bin.tar.gz
tar zxvf apache-maven-${MVN_VERSION}-bin.tar.gz

cat >> ~/.bash_profile << EOF
PATH=\${HOME}/bin/apache-maven-${MVN_VERSION}/bin:\${PATH}
export PATH
EOF

. ~/.bash_profile
mvn -version
cd

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.