天天看点

fedora20 编译Hadoop-eclipse 1.1.2插件(hadoop开发环境搭建)

fedora 20 hadoop开发环境搭建

1、配置信息:

操作系统:fedora 20 X86

eclipse版本:eclipse-jee-helios-SR2-linux-gtk.tar.gz(最好选用Galileo或Helios,不然可能有兼容问题)

hadoop版本:hadoop-1.1.2.tar.gz

ant版本:apache-ant-1.9.3-bin.tar.gz

2、编译生成hadoop-eclipse-plugin-1.1.2.jar

2.1修改${hadoop.root}/src/contrib目录的build-contrib.xml文件,添加eclipse路径和hadoop版本信息

<property name=”eclipse.home” location=”/hugl/android/eclipse” />

<property name=”version” value=”1.1.2″/>

如图所示:

fedora20 编译Hadoop-eclipse 1.1.2插件(hadoop开发环境搭建)

2.2修改${hadoop.root}/src/contrib/eclipse-plugin目录下的build.xml文件,在id为classpath的path节点添加hadoop-core的jar依赖,添加如下一条记录

<pathelement location="${hadoop.root}/hadoop-core-1.1.2.jar"/>

如图所示:

fedora20 编译Hadoop-eclipse 1.1.2插件(hadoop开发环境搭建)

同时修改找到name为jar的target,将相应的jar文件打包进插件的lib目录

将原来的 <copy file="${hadoop.root}/build/hadoop-core-${version}.jar" tofile="${build.dir}/lib/hadoop-core.jar" verbose="true"/>

    <copy file="${hadoop.root}/build/ivy/lib/Hadoop/common/commons-cli-${commons-cli.version}.jar"  todir="${build.dir}/lib" verbose="true"/>两行记录注释掉,将如下结果添加在此处:

<copy file="${hadoop.root}/hadoop-core-${version}.jar" tofile="${build.dir}/lib/hadoop-core.jar" verbose="true"/>

<copy file="${hadoop.root}/lib/commons-cli-${commons-cli.version}.jar" todir="${build.dir}/lib" verbose="true"/>

<copy file="${hadoop.root}/lib/commons-lang-2.4.jar" todir="${build.dir}/lib" verbose="true"/>

<copy file="${hadoop.root}/lib/commons-configuration-1.6.jar" todir="${build.dir}/lib" verbose="true"/>

<copy file="${hadoop.root}/lib/jackson-mapper-asl-1.8.8.jar" todir="${build.dir}/lib" verbose="true"/>

<copy file="${hadoop.root}/lib/jackson-core-asl-1.8.8.jar" todir="${build.dir}/lib" verbose="true"/>

<copy file="${hadoop.root}/lib/commons-httpclient-3.0.1.jar" todir="${build.dir}/lib" verbose="true"/>

如图所示:

fedora20 编译Hadoop-eclipse 1.1.2插件(hadoop开发环境搭建)

2.3修改MANIFEST.MF文件里面Bundle-ClassPath属性值

修改结果为:Bundle-ClassPath: classes/,lib/hadoop-core.jar,lib/commons-cli-1.2.jar,lib/commons-configuration-1.6.jar,lib/commons-httpclient-3.0.1.jar,lib/commons-lang-2.4.jar,lib/jackson-core-asl-1.8.8.jar,lib/jackson-mapper-asl-1.8.8.jar

如图所示:

fedora20 编译Hadoop-eclipse 1.1.2插件(hadoop开发环境搭建)

3、在命令行进入 ${hadoop.root}/src/contrib/eclipse-plugin目录,输入ant命令

最后在${hadoop.root}/build/contrib/eclipse-plugin目录生成打包好的插件,将hadoop-eclipse-plugin-1.1.2.jar文件复制到eclipse的plugins目录

4、点击Eclipse->Window->Open Perspectice->other 选择Map/Reduce,如图所是:

fedora20 编译Hadoop-eclipse 1.1.2插件(hadoop开发环境搭建)

5、点击Eclipse->Window->show view->other 选择Map/Reduce Locations,如图所是:

fedora20 编译Hadoop-eclipse 1.1.2插件(hadoop开发环境搭建)

6、在eclipse 右下侧,右键选择选择 New hadoop location,配置好后就ok了

fedora20 编译Hadoop-eclipse 1.1.2插件(hadoop开发环境搭建)

继续阅读