windows上编译eclipse-plugin for hadoop-0.20.2-cdh3u3
hadoop-0.20.2-cdh3u3目录为:E:\hadoop-0.20.2-cdh3u3\lib
复制E:\hadoop-0.20.2-cdh3u3\src\contrib\build-contrib.xml 到
E:\hadoop-0.20.2-cdh3u3\src\contrib\eclipse-plugin
修改E:\hadoop-0.20.2-cdh3u3\src\contrib\eclipse-plugin\build-contrib.xml
找到<property name="hadoop.root" location="${root}/../../../"/>
修改location为hadoop的实际解压目录,在其下添加:
<property name="eclipse.home" location="你的Eclipse安装目录"/>
<property name="version" value="Hadoop安装版本"/>
修改后:
<property name="hadoop.root" location="E:/hadoop-0.20.2-cdh3u3/"/> <property name="eclipse.home" location="E:/liuxiaowen-bak/eclipse-jee-europa-winter-win32/eclipse"/> <property name="version" value="0.20.2-cdh3u3"/>
修改E:\hadoop-0.20.2-cdh3u3\src\contrib\eclipse-plugin\build.xml
找到<import file="../build-contrib.xml"/>,改为<import file="build-contrib.xml"/>
找到<path id="classpath">,在下面添加 <pathelement location="${hadoop.root}/hadoop-core-0.20.2-cdh3u3.jar"/>
复制一些jar包,以下目标目录如果不存在,则先创建:
复制hadoop-core-0.20.2-cdh3u3.jar 到 E:\hadoop-0.20.2-cdh3u3\build
复制E:\hadoop-0.20.2-cdh3u3\lib\commons-cli-1.2.jar 到 E:\hadoop-0.20.2-cdh3u3\build\ivy\lib\Hadoop\common
进入目录:E:\hadoop-0.20.2-cdh3u3\src\contrib\eclipse-plugin
运行编译命令:
ant -Declipse.home=E:/liuxiaowen-bak/eclipse-jee-europa-winter-win32/eclipse -Dversion=0.20.2-cdh3u3 jar
编译后的jar包位于:E:\hadoop-0.20.2-cdh3u3\build\contrib\eclipse-plugin\hadoop-eclipse-plugin-0.20.2-cdh3u3.jar
后续:
在E:\hadoop-0.20.2-cdh3u3\lib目录找到
jackson-core-asl-1.5.2.jar
jackson-mapper-asl-1.5.2.jar
guava-r09-jarjar.jar
并用rar解压.
将每个jar报解压后的org目录拖进hadoop-eclipse-plugin-0.20.2-cdh3u3.jar的classes目录下。
编译时候还遇到另外的错:
[javac] /home/hdfs/lxw/lxw-hadoop/hadoop-0.20.2-cdh3u3/src/contrib/eclipse-plugin/src/java/org/apache/hadoop/eclipse/launch/HadoopApplicationLaunchShortcut.java:35: cannot find symbol [javac] symbol : class JavaApplicationLaunchShortcut [javac] location: package org.eclipse.jdt.debug.ui.launchConfigurations [javac] import org.eclipse.jdt.debug.ui.launchConfigurations.JavaApplicationLaunchShortcut; [javac] ^
发现是由于和eclipse版本有关,使用的的eclipse版本为必须为Indigo,
下载地址:http://mirrors.ustc.edu.cn/eclipse/technology/epp/downloads/release/indigo/SR2/eclipse-java-indigo-SR2-win32.zip
hdfs连接成功:
推荐阅读