Document toolboxDocument toolbox

Bootstrap on Ubuntu Linux

Required Software

  • Java 1.6+
  • Maven 3.0.3+
  • Git (not ancient...)
  • Eclipse for Java EE developers (I used 3.7 Juno)

For ubuntu the last three are easy.  Sun Java can be a bit tricky in the newer versions, but there are already plenty of guides about how to do that on the internet.  Specifically, I used this one: http://www.devsniper.com/ubuntu-12-04-install-sun-jdk-6-7/

Also, if after you install maven you get an error that looks something like this:

Exception in thread "main" java.lang.NoClassDefFoundError: org/codehaus/plexus/classworlds/launcher/Launcher
Caused by: java.lang.ClassNotFoundException: org.codehaus.plexus.classworlds.launcher.Launcher
	at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
	at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
Could not find the main class: org.codehaus.plexus.classworlds.launcher.Launcher

Then chances are good that, like me, your M2_HOME environment variable is set to the wrong place.  To find the right place execute:

find /usr -type d -name maven

On my machine it was /usr/share/maven

Maven Options

On occasion, I've had problems doing a full mvn install on the repo services because of getting an OutOfMemory exception on the last module.  I solved this by adding this to my .bashrc

export MAVEN_OPTS=-Xmx1024m

 This sets the limit on the jvm that maven starts to a bit higher than the default, which should be enough.  (I actually set it to 2048m, but that's cause I'm paranoid : )

Setting up Eclipse

You need to add some software sources for the Eclipse plugins:

Go to the Preferences page then Install/Update->Available Software

Add these url's one by one as new software sources (using the add button to the left)

  • m2e  url: http://download.eclipse.org/technology/m2e/releases
  • gwt   url: http://dl.google.com/eclipse/plugin/3.7
  • (optionally) egit url: http://download.eclipse.org/releases/juno
    • note that I don't use the eclipse git integration so I can't speak to it's stability, usability etc.

Close the preferences pane.  Now go to Help -> Install New Software

First(for no particular reason) install GWT plugins :

Type gwt into the Work with box.

When the info loads, select the Google Plugin for Eclipse and the SDK -> Google Web Toolkit SDK 2.4.0.  Selecting the SDK as well means you don't have to separately install GWT.  Continue through the dialogs, accept the license agreements and eventually finish.  Let Eclipse install everything and restart.  Say ok if it asks you about unsigned content (we trust Google, right?)

Now go back to the Install New Software Dialog and this time work with the m2e source.

Here I selected only the m2e plugin itself, and not the optional logging component.

Again, wade through the dialogs and eventually finish and let eclipse install restart.

Maven Build

Now follow the instructions for Getting the Maven Build Working in the Developer Bootstrap page.

MySQL Setup

A couple notes:

If you setup your settings.xml file as the above page describes, you also need to do a couple things to setup mysql.  In addition to your root user, you need to create your dev<user> user.  To do this login as root to your mysql database and enter:

create user 'dev<user>'@'localhost' identified by 'platform';
grant all on dev<user>.* to 'dev<user>'@'localhost';

Where <user> is replaced by whatever you replaced deflaux with in the settings.xml file, or rather, whatever appears in this block of that file:

   <org.sagebionetworks.developer>geoff</org.sagebionetworks.developer>

Importing Projects

Now you should be ready to start importing your projects.  Before you do this section you should follow the instructions on forking and cloning the code repo's

Go to File -> Import -> Maven -> Existing Maven Projects

Now hopefully, you did the smart thing and put all the sage projects in one common root folder.  If so, browse to that location in the Root Directory box.  Maven will recursively scan the directories and find all maven projects.  You are then presented with a list.  Choose the projects that are actually sage related (Portal, Repostiory-Services), also including all the sub-projects under Repo and click next.  Accept eclipse's automatic mapping of maven plugins to eclipse plugins.  Ignore it if can't find a match for javacc.  Eclipse will probably complain that if you continue you will have projects with build errors.  Accept and bravely continue on.  Keep accepting, and continuing until Eclipe finishes installing and restarting.

For information about fixing the build errors, check out Developer Bootstrap on fixing eclipse build issues.