EclipseEnvironment

Working with Hadoop under Eclipse

Here are instructions for setting up a development environment for Hadoop under the Eclipse IDE. Please feel free to make additions or modifications to this page. At worst, if you see anything wrong please let me, MarcoNicosia, know.

This document (currently) assumes you already have Eclipse downloaded, installed, and configured to your liking.

Download and install the Subversive plug-in

The easiest way to download and install is to use Eclipse's Update Manager. That process is well described one [WWW] the Subversive's site. Think to add the two update sites.

Associate the Hadoop Trunk Repository

Create a Project

From the SVN Repositories perspective:

Using Subversive with already checkouted projects

Refer to the [WWW] Subversive FAQ.

Configuring Eclipse to build Hadoop

As of 28 March 2008 there is an ant task for generating the requisite Eclipse files (see [WWW] HADOOP-1228). Follow these instructions to configure Eclipse:

  1. Set up an ANT_HOME Classpath Variable in Eclipse Preferences. This is a global Eclipse setting so you only need to do this once.

  2. Checkout Hadoop.

  3. Run the eclipse-files ant target (right click build.xml, choose run as Ant Build and choose eclipse-files target)

  4. Refresh the Eclipse project.

  5. Ensure that the Java version used matches the version of the project (currently 1.6 is used). This could be selected for the project by going to Project > Preferences > Builders > Hadoop_Ant_Builders. Go to JRE tab and select an appropriate Java version.

  6. Select Project | Build Project.

Manual Settings

If you want to build all of Hadoop in Eclipse then there are some [WWW] DDL files used by the tests that need to compiled first. One strategy is to configure Eclipse to call part of the Ant script to build these, and have two build directories, one for the Ant script, the other for Eclipse, as you need to include the classes built by Ant on the Eclipse library path and circular references are forbidden.

In Eclipse, select Project -> Properties -> Java Build Path -> Source

Then ensure the following source directories are on the Java build path:

hadoop/src/examples
hadoop/src/java
hadoop/src/test

Then if you want to use the contrib directories as well:

hadoop/src/contrib/test
hadoop/src/contrib/abacus/examples
hadoop/src/contrib/abacus/src/java
hadoop/src/contrib/data_join/src/join
hadoop/src/contrib/hbase/src/java
hadoop/src/contrib/hbase/src/test
hadoop/src/contrib/streaming/src/java
hadoop/src/contrib/streaming/src/test

and set the output folder to

hadoop/eclipse-build

Then select Project -> Properties -> Java Build Path -> Libraries

Add all the libraries (.jar files) in

hadoop/lib
hadoop/lib/jetty-ext

If you are using contrib also add all the libraries (.jar files) in

hadoop/src/contrib/hbase/lib

Then add the classes in

hadoop/build/test/classes

Then select Project->Properties->Builders

Add a new Ant builder. Select the top level build.xml as the build file. Next select the "targets" tab, after clean specify

compile-core-classes, compile-core test

then after manual build specify

compile-core-classes, compile-core-tests, compile

Apply these changes. Hopefully Hadoop should now build successfully in Eclipse without any errors.

last edited 2008-08-29 17:02:49 by sureshms