下载Hadoop的release, http://labs.renren.com/apache-mirror/hadoop/common/
下载ant,http://labs.renren.com/apache-mirror/ant/binaries/
将Ant解压至硬盘上,比如D:\ant
设置环境变量
Ant_HOME = D:\ant
将%Ant_HOME%\bin加入到PATH当中。
解压Hadoop的release。
进入%Hadoop_HOME%\src\contrib\
编辑build-contrib.xml
加入
<property name="version" value="1.0.3"/>
<property name="eclipse.home" location="D:/soft/eclipse-jee-indigo-SR1-win32/eclipse"/>
将%Hadoop_HOME%下的jar包拷到eclipse所在目录的plugins目录下,比如hadoop-core-*.jar
进入%Hadoop_HOME%\src\contrib\eclipse-plugin
编辑build.xml
在
<path id="eclipse-sdk-jars">
<fileset dir="${eclipse.home}/plugins/">
</fileset>
</path>
中加入
<include name="hadoop*.jar"/>
打开CMD在%Hadoop_HOME%\src\contrib\eclipse-plugin下使用ant
这时开始编译。
- jar:
- [echo] version:1.0.3
- [copy] Copying 1 file to D:\hadoop-1.0.3\build\contrib\eclipse-plugin\lib
- [copy] Copying D:\hadoop-1.0.3\build\ivy\lib\Hadoop\common\commons-cli-1.2.
- jar to D:\hadoop-1.0.3\build\contrib\eclipse-plugin\lib\commons-cli-1.2.jar
- [jar] Building jar: D:\hadoop-1.0.3\build\contrib\eclipse-plugin\hadoop-ec
- lipse-plugin-1.0.3.jar
-
- BUILD SUCCESSFUL
- Total time: 2 seconds
注意,在编译的过程中可能会报错,主要出在jar时的copy问题上,把commons-cli-1.2.jar与拷到 %HADOOP_HOME%\build\ivy\lib\Hadoop\common\下,将hadoop-core-1.0.3.jar拷到%HADOOP_HOME%\build下即可。
编译成功后,会在 %Hadoop_Home%\build\contrib\eclipse-plugin\下生成hadoop-eclipse-plugin-1.0.3.jar。将其拷到eclipse所在目录的plugins目录下。重新打开eclipse
选择window-open perspective-other,会看到
选择Map/Reduce
选择window-show view-other
选择Map/Reduce Locaions
到这eclipse的hadoop插件就编译成功了。
本文出自 “若是人间” 博客,请务必保留此出处http://xiaoruoen.blog.51cto.com/4828946/872274