hadoop eclipse plugin的生成

来源:互联网 发布:走路赚钱软件 编辑:程序博客网 时间:2024/05/21 06:34
参考:http://trac.nchc.org.tw/cloud/wiki/waue/2010/0211
     http://gushuizerotoone.iteye.com/blog/638480
     http://whxhz.iteye.com/blog/1609218
可能有时候因为eclipse版本或者操作系统版本的问题使得hadoop 提供的 eclipseplugin不太好用。可以自己生成

1.修改$HADOOP_HOME/src/contrib/build-contrib.xml
增加一行::<property name="eclipse.home"location="/opt/eclipse"/> 
上句后面的/opt/eclipse 由自己的$ECLIPSE_HOME代替

2.修改$HADOOP_HOME/src/contrib/eclipse-plugin/src/java/org/apache/hadoop/eclipse/launch/HadoopApplicationLaunchShortcut.java
注释掉原来的//importorg.eclipse.jdt.internal.debug.ui.launcher.JavaApplicationLaunchShortcut;
改为importorg.eclipse.jdt.debug.ui.launchConfigurations.JavaApplicationLaunchShortcut;

3.执行:
cd $HADOOP_HOME
ant compile
ln -sf $HADOOP_HOME/docs $HADOOP_HOME/build/docs
ant package

4.在执行最后一句的时候会遇到问题: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.
说没有define java5的home目录,因为我装的是java6
安装jdk1.5
再去下一个apache-forrest-0.9:http://forrest.apache.org/mirrors.cgi For UNIXoperating systems: apache-forrest-0.9-sources.tar.gz
解压后,(如我放在 /opt/apache-forrest-0.9)

则重新执行命令:ant package -Djava5.home=/opt/jdk1.5_22-Dforrest.home=/opt/apache-forrest-0.9

注意上面的java5路径和apache-forrest路径要根据你自己的安装路径而设定,按上述方法由出现forrest的问题,遂采用步骤5

5.做法是对$HADOOP_HOME目录下的build.xml文件进行修改,两句注释掉,修改成如下所示:

<targetname="forrest.check" unless="forrest.home"depends="java5.check">
<!--failmessage="'forrest.home' is not defined. Please pass-Dforrest.home=&lt;base of Apache Forrestinstallation&gt; to Ant on the command-line."/-->
</target>

<targetname="java5.check"unless="java5.home">
<!--failmessage="'java5.home' is not defined.  Forrestrequires Java 5.  Please pass-Djava5.home=&lt;base of Java 5distribution&gt; to Ant on the command-line."/-->
</target>

ok,应该会在$HADOOP_HOME/build/contrib/eclipse-plugin/hadoop-0.20.3-dev-eclipse-plugin.jar
修改名字为hadoop-0.20.2-eclipse-plugin.jar。 
原创粉丝点击