varyall 发表于 2013-2-7 06:47:07

Compile hadoop eclipse-plugin 0.20.2 for Eclipse 3.5 on Mac/Ubuntu

Since the original eclipse-plugin of Hadoop 0.20.2 doesn’t work well, because the plugin is developed under eclipse europa, i.e., 3.3. The phenomenon of mine is that when I click the “Run on Hadoop”, there will be nothing continue. Here (if you can read Chinese ^_^) offers a good way to ignore this, to write a self-write Makefile. This is easy, actually I am using this way finished my first little hadoop project, but also boring. So I want to make the eclipse-plugin work well. Then I found some other help from:

http://wiki.apache.org/hadoop/EclipsePlugIn
http://trac.nchc.org.tw/cloud/wiki/waue/2010/0211 (help me a lot)
http://hi.baidu.com/feng2211/blo … b1b9a42eddd48e.html
http://yjhexy.iteye.com/blog/591769

All links above except the first one are written in Chinese.
However, this work is not so hard, I finished this in one hour, and I will describe my steps in the follow:

上边的第一个连接是中文的.

1. Modify two files

1.修改两个文件

* $HADOOP_HOME/src/contrib/build-contrib.xml
加上这一行<property name=”eclipse.home” location=”$Eclipse_HOME” />
Since I am working on Mac OS X 10.5, so here my $Eclipse_HOME is /Applications/eclipse

我的系统是MAC OS X 10.5,所以我的$Eclipse_HOME是/Applications/eclipse.

* $HADOOP_HOME/src/contrib/eclipse-plugin/src/java/org/apache/hadoop/eclipse/launch/HadoopApplicationLaunchShortcut.java
comment the original/注释掉下面这一行
import org.eclipse.jdt.internal.debug.ui.launcher.JavaApplicationLaunchShortcut;
but add/加上下面这一行
import org.eclipse.jdt.debug.ui.launchConfigurations.JavaApplicationLaunchShortcut;

2. Compile
The basic steps are as follows:
cd $HADOOP_HOME/
ant compile
ant package

Several problems I met when I executing ant package: 有几个问题在运行ant package的时候遇到的:

* First, I was told that:
build.xml:908: ‘java5.home’ is not defined. Forrest requires Java 5. Please pass -Djava5.home=<base 5="" distribution> to Ant on the command-line.
For this, I use:把ant package命令改为如下:
ant package -Djava5.home=/System/Library/Frameworks/JavaVM.framework/Versions/1.5.0

* Then I was told:
build.xml:904: ‘forrest.home’ is not defined. Please pass -Djava5.home=<base of Java 5 distribution> to Ant on the command-line.
That’s because I don’t have apache forrest in my computer. So I go to here to download it, then decompress it to $Forrest_HOME (self-defined) Then use:

这是由于我没有安装apache forrest. 所以我下载并解压到硬盘.然后把ant package改成入下:
ant package -Djava5.home=/System/Library/Frameworks/JavaVM.framework/Versions/1.5.0 -Dforrest.home=$Forrest_HOME/apache-forrest-0.8

* Then I was told:
Error: JAVA_HOME is not defined correctly.
We cannot execute /System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/bin/java
That’s because the JDK in Mac OS X is different from Unix or Windows. So I create a link called bin under the JDK For take a work around. Then everything works very fine.

我是在UBUNTU环境下尝试的,所以不同于作者,只要你的系统有JDK 1.5版本的基本不会出现此问题. 记住一定要是JDK1.5的.

3. Result
The result jar file is inside:
$HADOOP_HOME/build/contrib/eclipse-plugin/hadoop-0.20.3-dev-eclipse-plugin.jar

It’s very funny that file name is different from the default one. You can change it by your self interesting.


引用:http://blog.5188la.net/2010/06/compile-hadoop-eclipse-plugin-0-20-2-for-eclipse-3-5-on-mac/
页: [1]
查看完整版本: Compile hadoop eclipse-plugin 0.20.2 for Eclipse 3.5 on Mac/Ubuntu