Rumah > Artikel > pangkalan data > 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上,
本文主要讲解如何编译安装配置 Hadoop2.x eclipse plugin插件的详细过程: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
文件,增加两处修改具体如下:
<import file="../build-contrib.xml"></import> <!-- ex-jar 是需要增加的配置 micmiu.com--> <path id="ex-jars"> <fileset dir="./"> <include name="org.eclipse.jdt*.jar"></include> </fileset> </path> ...... <!-- Override classpath to include Eclipse SDK jars --> <path id="classpath"> <pathelement location="${build.classes}"></pathelement> <!--pathelement location="${hadoop.root}/build/classes"/--> <path refid="eclipse-sdk-jars"></path> <path refid="hadoop-sdk-jars"></path> <!-- 需要增加的配置 micmiu.com--> <path refid="ex-jars"></path> </path> ......然后再执行编译命令,看到?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.jar 到 eclipse/plugins 路径下,重启eclipse即可。 2、在eclipse菜单依次点击 ?windows →?show view →?other… ,选择“Show View”对话框打开,搜索框输入“map”,会找到项“Map/Reduce Locations”,点击“确定”按钮: 3、控制台会多出一个“Map/Reduce Locations”的Tab页: 4、在“Map/Reduce Locations” Tab页 点击图标 ? 或者在空白的地方右键,选择“New Hadoop location…”,弹出对话框“New hadoop location…”,配置如下内容:
hdfs-site.xml
中配置dfs.datanode.ipc.address的值填写core-site.xml
中配置fs.defaultFS的值填写/usr/local/share/hadoop-2.2.0
—————– ?EOF?@Michael Sun?—————–