Tutorial: Installing Maven on RaspberryPi

less than 1 minute read

Just RaspberryPi Things

Installing Maven

In order to manually install a specific version of maven 3 on RaspberryPi.

Download the Binary tar.gz version the maven website. Pick the latest version.
wget http://www.mirrorservice.org/sites/ftp.apache.org/maven/maven-3/<version>/binaries/apache-maven-<version>-bin.tar.gz

Extract the archive to to /opt.
sudo tar -xzvf apache-maven-<version>-bin.tar.gz -C /opt

Now we need to tell shell where to find maven. We’ll do this in the system profile settings so it is available to all users.
sudo edit /etc/profile.d/maven.sh
and enter

export M2_HOME=/opt/apache-maven-3.2.5
export PATH=$PATH:$M2_HOME/bin

Quit and save from the editor.

Log out and back into the Raspberry Pi so the profile script takes effect and there it is. You can test that it is working with
mvn -version
and you should see that the maven version is shown as the version that you have downloaded