Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 5.3

...

...

Table of Contents

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 first last three are easy.  Well, Sun  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:

Code Block
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:

Code Block
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

Code Block
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:

...

  • 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.

...

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:

Code Block
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:

Code Block
   <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

...

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, we'll fix that in a moment.  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.

At this point, I closed Eclipse again (actually, it crashed) and ran:

Code Block
mvn eclipse:eclipse

in the root of portal and repo-service directories.  This generates eclipse files using maven's version of the classpath.

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