hadoop-eclipse-plugin-2.x.x 插件编译

在网上找的hadoop for eclipse 插件都不能用,决定自己去编译一个。Hadoop 提供了一个 Eclipse 插件以方便用户在 Eclipse 集成开发环境中使用 Hadoop,如管理 HDFS 上的文件、提交作业、调试 MapReduce 程序等。

Hadoop版本:hadoop 2.x.x
Eclipse版本:Mars Release (4.5.0)

1.JDK配置

1) 安装jdk
2) 配置环境变量
JAVA_HOME、CLASSPATH、PATH等设置

2. Eclipse

1).下载eclips
2).解压到本地磁盘

3. Ant

1)下载
http://ant.apache.org/bindownload.cgi
apache-ant-1.9.8-bin.zip

2)解压到一个盘

3)环境变量的配置
新建ANT_HOME= D:Program Filesapache-ant-1.9.8
在PATH后面加;%ANT_HOME%in

4)cmd 测试一下是否配置正确

ant -version  

4.Hadoop

使用的hadoop 2.x.x

下载hadoop2x-eclipse-plugin源代码
1)目前hadoop2的eclipse-plugins源代码由github脱管,下载地址是
https://github.com/winghc/hadoop2x-eclipse-plugin,然后在右侧的Download ZIP连接点击下载

2)下载hadoop2x-eclipse-plugin-master.zip

解压到本地磁盘

5. 编译hadoop-eclipse-plugin插件

1) hadoop2x-eclipse-plugin-master解压在桌面上,打开命令行cmd,切换到C:UsersxxDesktophadoop2x-eclipse-plugin-mastersrccontribeclipse-plugin 目录

2)

ant jar -Dversion=hadoop 2.x.x  -Dhadoop.version=2.x.x -Declipse.home=D:Program Fileseclipse -Dhadoop.home= C:UsersxxDesktophadoop

version: plugin version
hadoop.version: hadoop version you want to compiled with
eclipse.home: path of eclipse home
hadoop.home: path of hadoop 2.x home

6.编译问题解决:

1.

For different hadoop, adjust ${hadoop2x-eclipse-plugin-master}/ivy/libraries.properties, to match  hadoop dependency lib version.

2.

modify ${hadoop2x-eclipse-plugin}/src/contrib/eclipse-plugin/build.xml, in the node: <attribute name="Bundle-ClassPath" ....to add the jar needed.

7.如何调试:

start eclipse with debug parameter:

/opt/eclipse/eclipse -clean -consolelog –debug

不建议自己编译,编译的过程中出现各种问题,按照网上各种修改,不一定能改正确。

最好的办法是参考官方的编译版本,拿过来直接使用:
https://github.com/winghc/hadoop2x-eclipse-plugin/tree/v2.6.0/release

8.使用插件:

1) 将插件放到Eclipse安装目录的plugins文件夹下

2) 通过window-》preference 找到下图所示,选择Hadoop软件的目录位置:

3)New hadoop location

4)配置 hadoop location

设置 fs.defaultFS 为 hdfs://localhost:9000,则 DFS Master 的 Port 要改为 9000。Map/Reduce(V2) Master 的 Port 用默认的即可,Location Name 随意填写。

5)查看效果

配置完毕,查看效果

我这里使用的是hadoop-eclipse-plugin-2.6.0。

下载地址:http://download.csdn.net/download/u013067629/9734007

原文地址:https://www.cnblogs.com/bigdata1024/p/8387425.html