欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  数据库

Hadoop2.x eclipse plugin插件编译安装配置

程序员文章站 2024-04-04 11:00:05
...

本文主要讲解如何编译安装配置 Hadoop2.x eclipse plugin插件的详细过程: 环境参数 编译过程 安装配置 [一]、环境参数 Eclipse Juno Service Release 2 Hadoop2.2.0 Java 1.6.0_65 Mac OXS 10.9.2 [二]、编译过程 目前Hadoop2.x的插件源码托管在github上,

Hadoop2.x eclipse plugin插件编译安装配置本文主要讲解如何编译安装配置 Hadoop2.x eclipse plugin插件的详细过程:
  • 环境参数
  • 编译过程
  • 安装配置
[一]、环境参数
  • Eclipse Juno Service Release 2
  • Hadoop2.2.0
  • Java 1.6.0_65
  • Mac OXS 10.9.2
[二]、编译过程 目前Hadoop2.x的插件源码托管在github上,第一步肯定是下载源码
git clone https://github.com/winghc/hadoop2x-eclipse-plugin.git
编译源码:
$cd src/contrib/eclipse-plugin
$ant jar -Dversion=2.2.0 -Declipse.home=/Applications/eclipse -Dhadoop.home=/usr/local/share/hadoop
但是在我的机器上第一次编译时失败了,类似下面的错误信息:
............
[javac] Compiling 45 source files to /Users/micmiu/no_sync/opensource_code/hadoop/hadoop2x-eclipse-plugin/build/contrib/eclipse-plugin/classes
    [javac] /Users/micmiu/no_sync/opensource_code/hadoop/hadoop2x-eclipse-plugin/src/contrib/eclipse-plugin/src/java/org/apache/hadoop/eclipse/MapReduceNature.java:35: package org.eclipse.jdt.core does not exist
    [javac] import org.eclipse.jdt.core.IClasspathEntry;
    [javac]                            ^
    [javac] /Users/micmiu/no_sync/opensource_code/hadoop/hadoop2x-eclipse-plugin/src/contrib/eclipse-plugin/src/java/org/apache/hadoop/eclipse/MapReduceNature.java:36: package org.eclipse.jdt.core does not exist
    [javac] import org.eclipse.jdt.core.IJavaProject;
    [javac]                            ^
..............
初步判断估计是我的eclipse中没有 org.eclipse.jdt.core* 相关lib包,无法找到类引起的,后来去我的本机目录?/Applications/eclipse/plugins/ 下查看发现确实没有类似的lib包,证明了之前的判断。只好从其他同事电脑上找到一个 org.eclipse.jdt.core_3.7.3.v20120119-1537.jar ?copy到插件的源码目录 ?src/contrib/eclipse-plugin/lib 下,同时需要修改?src/contrib/eclipse-plugin/build.xml 文件,增加两处修改具体如下:
  
 ......
  
  
  ......
然后再执行编译命令,看到?BUILD SUCCESSFUL 表示编译成功:
micmiu-mbp:eclipse-plugin micmiu$ ant jar -Dversion=2.2.0 -Declipse.home=/Applications/eclipse -Dhadoop.home=/usr/local/share/hadoop
Buildfile: /Users/micmiu/no_sync/opensource_code/hadoop/hadoop2x-eclipse-plugin/src/contrib/eclipse-plugin/build.xml
check-contrib:
init:
     [echo] contrib: eclipse-plugin
init-contrib:
ivy-download:
      [get] Getting: http://repo2.maven.org/maven2/org/apache/ivy/ivy/2.1.0/ivy-2.1.0.jar
      [get] To: /Users/micmiu/no_sync/opensource_code/hadoop/hadoop2x-eclipse-plugin/ivy/ivy-2.1.0.jar
      [get] Not modified - so not downloaded
ivy-probe-antlib:
ivy-init-antlib:
ivy-init:
[ivy:configure] :: Ivy 2.1.0 - 20090925235825 :: http://ant.apache.org/ivy/ ::
[ivy:configure] :: loading settings :: file = /Users/micmiu/no_sync/opensource_code/hadoop/hadoop2x-eclipse-plugin/ivy/ivysettings.xml
ivy-resolve-common:
ivy-retrieve-common:
[ivy:cachepath] DEPRECATED: 'ivy.conf.file' is deprecated, use 'ivy.settings.file' instead
[ivy:cachepath] :: loading settings :: file = /Users/micmiu/no_sync/opensource_code/hadoop/hadoop2x-eclipse-plugin/ivy/ivysettings.xml
compile:
     [echo] contrib: eclipse-plugin
    ......
    [javac] Note: Some input files use or override a deprecated API.
    [javac] Note: Recompile with -Xlint:deprecation for details.
    [javac] Note: Some input files use unchecked or unsafe operations.
    [javac] Note: Recompile with -Xlint:unchecked for details.
    [javac] 7 warnings
jar:
    [mkdir] Created dir: /Users/micmiu/no_sync/opensource_code/hadoop/hadoop2x-eclipse-plugin/build/contrib/eclipse-plugin/lib
     [copy] Copying 9 files to /Users/micmiu/no_sync/opensource_code/hadoop/hadoop2x-eclipse-plugin/build/contrib/eclipse-plugin/lib
     ......
      [jar] Building jar: /Users/micmiu/no_sync/opensource_code/hadoop/hadoop2x-eclipse-plugin/build/contrib/eclipse-plugin/hadoop-eclipse-plugin-2.2.0.jar
BUILD SUCCESSFUL
Total time: 37 seconds
micmiu-mbp:eclipse-plugin m
编译成功后可以在?build/contrib/eclipse-plugin/hadoop-eclipse-plugin-2.2.0.jar 找到生成的jar包。 下载地址:http://yun.baidu.com/s/1o6K457c#dir/path=%2Fsourcecode%2Fbuilder [三]、安装配置 1、复制生成的 hadoop-eclipse-plugin-2.2.0.jareclipse/plugins 路径下,重启eclipse即可。 2、在eclipse菜单依次点击 ?windows →?show view →?other… ,选择“Show View”对话框打开,搜索框输入“map”,会找到项“Map/Reduce Locations”,点击“确定”按钮: Hadoop2.x eclipse plugin插件编译安装配置 3、控制台会多出一个“Map/Reduce Locations”的Tab页: Hadoop2.x eclipse plugin插件编译安装配置 4、在“Map/Reduce Locations” Tab页 点击图标 ?Hadoop2.x eclipse plugin插件编译安装配置 或者在空白的地方右键,选择“New Hadoop location…”,弹出对话框“New hadoop location…”,配置如下内容: Hadoop2.x eclipse plugin插件编译安装配置
  • Location name :随便取个名字 比如 hadoop2.2.0
  • Map/Reduce(V2) Master :根据hdfs-site.xml中配置dfs.datanode.ipc.address的值填写
  • DFS Master: Name Node的IP和端口,根据core-site.xml中配置fs.defaultFS的值填写
配置成功后可以看到类似如下信息: Hadoop2.x eclipse plugin插件编译安装配置 5、打开“preferences”对话框,搜索“hadoop”,找到”Hadoop Map/Reduce”项,点击”Browse…” 配置hadoop的路径,比如我的路径是 /usr/local/share/hadoop-2.2.0 —————– ?EOF?@Michael Sun?—————–