Installing maven on the Raspberry Pi

The Raspberry Pi‘s raspbian image comes with oracle-java8-jdk already installed and I wanted to use this with maven. However if you install maven using apt-get it will install all kindsĀ of other JDKs and things you don’t need. The solution to this is to install maven from it’s binary distribution. This is quite easy as everyhing it needs is already installed.

  1. 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/3.2.5/binaries/apache-maven-3.2.5-bin.tar.gz
  2. Extract the archive to to /opt.cd /opt
    sudo tar -xzvf /path/to/apache-maven-3.2.5-bin.tar.gz
  3. Tell you shell where to find maven. We’ll do this in the system profile settings so it is available to all users.sudoedit /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.

  4. 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 something like
    Apache Maven 3.2.5 (12a6b3acb947671f09b81f49094c53f426d8cea1; 2014-12-14T17:29:23+00:00)
    Maven home: /opt/apache-maven-3.2.5
    Java version: 1.8.0, vendor: Oracle Corporation
    Java home: /usr/lib/jvm/jdk-8-oracle-arm-vfp-hflt/jre
    Default locale: en_GB, platform encoding: UTF-8
    OS name: "linux", version: "3.12.26-rt40+", arch: "arm", family: "unix"

One thought on “Installing maven on the Raspberry Pi

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>