Wednesday, 26 December 2012

Installing Maven, Eclipse, Subversion and RabbitVCS on Linux Mint 14 (Cinnamon)

This guide will help you get set up for Java development on Linux Mint 14 (Cinnamon), using Maven, EclipseSubversion and RabbitVCS.


  • Linux Mint 14 (Cinnamon) installed (download here)

Install Oracle JDK7 (Optional)

My distribution came with OpenJDK 7 JRE. You can install the OpenJDK 7 JDK from the official repositories (sudo apt-get install openjdk-7-jdk), but I prefer to use the Oracle JDK (which isn't in the offical repositories due to licensing issues). If you're happy with OpenJDK then you can skip this step and install the OpenJDK instead (just note that the Java directory will be different for the next section when installing Maven 3).
  • Open a terminal (Ctrl-Alt-t)
  • Add the required APT repository
    sudo add-apt-repository ppa:webupd8team/java
  • Update the APT indexes
    sudo apt-get update
  • Install the Oracle JDK
    sudo apt-get install oracle-java7-installer
  • Accept the licence terms
  • Confirm the Oracle JDK is installed
    java -version

Install Maven 3

Sonatype's Maven manual is an excellent reference for installing and using Maven, but for quick reference here are the steps to install Maven 3.0.4.
  • Download the binary (apache-maven-3.0.4-bin.tar.gz) from the Apache Maven website
  • Open a terminal (Ctrl-Alt-t)
  • Navigate to the file and extract it
    cd ~/Downloads/
    tar xzf apache-maven-3.0.4-bin.tar.gz
  • Move it to /usr/local (as suggested in the installation guide in the Maven manual) and create a symbolic link
    sudo mv apache-maven-3.0.4 /usr/local
    cd /usr/local
    sudo ln -s apache-maven-3.0.4 maven
  • Ensure that the required environment variables and path are configured for Java and Maven by adding the following lines to the appropriate script (I used ~/.profile)
    # setup environment variables/path for Java/Maven
    export M2_HOME=/usr/local/maven
    export M2=$M2_HOME/bin
    export JAVA_HOME=/usr/lib/jvm/java-7-oracle
    export PATH=$M2:$JAVA_HOME/bin:$PATH
  • Log out and in again
  • Open a terminal (Ctrl-Alt-t)
  • Check that Maven is configured correctly
    mvn -v
  • If you've done everything correctly, this should print results similar to:
    Apache Maven 3.0.4 (r1232337; 2012-01-17 18:44:56+1000)
    Maven home: /usr/local/maven
    Java version: 1.7.0_10, vendor: Oracle Corporation
    Java home: /usr/lib/jvm/java-7-oracle/jre
    Default locale: en_AU, platform encoding: UTF-8
    OS name: "linux", version: "3.5.0-17-generic", arch: "amd64", family: "unix"

Install Eclipse

To install Eclipse Juno in your home directory
  • Download the package (I chose `Eclipse IDE for Java Developers') from the Eclipse website
  • Open a terminal (Ctrl-Alt-t)
  • Extract Eclipse and move to your home directory
    cd ~/Downloads
    tar xzf eclipse-java-juno-SR1-linux-gtk-x86_64.tar.gz
    mv eclipse ~
  • Right-click on the Menu in the bottom-left and choose 'Edit menu'
  • Click on the 'Programming' group, then click the 'New item' button
  • Add the following details for Eclipse and click the 'OK' button
    Type: Application
    Name: Eclipse
    Command: /home/yourusername/eclipse/eclipse
  • Optionally, navigate (or search) to Eclipse in the menu, right-click and choose 'add to desktop'
  • Verify that Eclipse was installed successfully by launching it from the menu (or desktop shortcut) 
  • If you're using the Maven Eclipse plugin, you will also want to ensure Eclipse is configured with the classpath variable M2_REPO by running the following command:
    mvn eclipse:configure-workspace -Declipse.workspace=/path/to/your/workspace

Install Subversion

To install Subversion:
  • Open a terminal (Ctrl-Alt-t)
  • Install Subversion
  • sudo apt-get install subversion
  • Confirm subversion is installed
    svn --version

Install RabbitVCS

RabbitVCS is an excellent GUI tool for Subversion. Unfortunately, there's no official support for Nemo (the new file manager for Cinnamon), but until there is there is a workaround (on the rabbitvcs issue tracker).

First, install rabbitvcs-core:
  • Open a terminal (Ctrl-Alt-t)
  • Add the required APT repository
    sudo add-apt-repository ppa:rabbitvcs/ppa
  • Update the APT indexes
    sudo apt-get update
  • Install rabbitvcs-core
    sudo apt-get install rabbitvcs-core
Now apply the workaround:
  • Download the attachment from comment 5 of the rabbitvcs issue
  • Add the required APT repository
    sudo add-apt-repository ppa:gwendal-lebihan-dev/cinnamon-stable
  • Update the APT indexes
    sudo apt-get update
  • Install python-nemo
    sudo apt-get install python-nemo
  • Copy the patch to the appropriate location
    cd ~/Downloads
    sudo mv /usr/share/nemo-python/extensions/
  • Log out and in again
You should now be able to see the RabbitVCS entries on the right-click menu, as well as the Subversion icon overlays for any of your Subversion repositories.

And that's it! You should be up and running for Java development on Linux Mint :)