Skip to main content

Hadoop: Build Eclipse Plugin From Source

Hello everyone! Today I studied hadoop the whole day, and have some problems. This article will show you how to build an eclipse plugin from hadoop 1.1.2 source code.

The eclipse plugin source code is located in

$HADOOP_HOME/src/contrib/eclipse-plugin

Where $HADOOP_HOME is your hadoop installation directory. You need Ant to run the build task.

First, we should set eclipse.home in build.properties file:

build.properties

 

The content:

output.. = bin/
bin.includes = META-INF/,\
               plugin.xml,\
               resources/,\
               classes/,\
               classes/,\
               lib/
eclipse.home=/home/xuqian/program/eclipse

In the build.xml file, add the following line:

 <property name='version' value='1.1.2'/>

This is because the build file will find hadoop-core-${version}.jar, and the ${version} is not defined, you should do it yourself.

Now, we must build hadoop first, because building eclipse plugin needs hadoop-core-1.1.2.jar. Go to $HADOOP_HOME, mine is /usr/local/hadoop, fron the terminal, run ant command.

Note: if you see the following error:

BUILD FAILED
/usr/local/hadoop/build.xml:618: Execute failed: java.io.IOException: Cannot run program "autoreconf" (in directory "/usr/local/hadoop/src/native"): error=2, No such file or directory
at java.lang.ProcessBuilder.start(ProcessBuilder.java:1042)
at java.lang.Runtime.exec(Runtime.java:615)
at org.apache.tools.ant.taskdefs.launcher.Java13CommandLauncher.exec(Java13CommandLauncher.java:41)

you should run

sudo apt-get install automake autoconf

Then, re-run ant, if you meet the below error:

create-native-configure:
[exec] Can't exec "libtoolize": No such file or directory at /usr/bin/autoreconf line 195.

You should run

 sudo apt-get install libtool

Now, waiting for ant build success, you can find hadoop-core-1.1.3-SNAPSHOT.jar, you must change it’s name to hadoop-core-1.1.2.jar.

Go to $HADOOP_HOME/src/contrib/eclipse-plugin directory again, and run ant command, after it success, you will find hadoop-eclipse-plugin-1.1.2.jar file in $HADOOP_HOME/build/contrib/eclipse-plugin

Copy it to your elipse/plugins folder, that’s it!

I will show you how to configure it on eclipse in the next tutorial, thank you! This article doesn’t explain the problem very clearly, if you have any problems, welcome to ask me, I’d very glad to help you!