您的位置:首页 > 编程语言 > Java开发

hadoop eclipse plugin的生成

2013-10-14 15:08 387 查看
参考:http://trac.nchc.org.tw/cloud/wiki/waue/2010/0211
http://gushuizerotoone.iteye.com/blog/638480 http://whxhz.iteye.com/blog/1609218 可能有时候因为eclipse版本或者操作系统版本的问题使得hadoop 提供的 eclipse
plugin不太好用。可以自己生成

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

注释掉原来的//import
org.eclipse.jdt.internal.debug.ui.launcher.JavaApplicationLaunchShortcut;

改为import
org.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 UNIX
operating 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文件进行修改,两句注释掉,修改成如下所示:

<target
name="forrest.check" unless="forrest.home"
depends="java5.check">

<!--fail
message="'forrest.home' is not defined. Please pass
-Dforrest.home=<base of Apache Forrest
installation> to Ant on the command-line."
/-->

</target>

<target
name="java5.check"
unless="java5.home">

<!--fail
message="'java5.home' is not defined. Forrest
requires Java 5. Please pass
-Djava5.home=<base of Java 5
distribution> 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。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: