进入%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"/>

  将compile模块中

  deprecation="${javac.deprecation}

  去掉。

  打开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插件就编译成功了。


附上我自己编译后的插件:hadoop-eclipse-plugin 1.0.3 eclipse4.2中可以使用

Eclipse 4.2 下载地址:http://www.eclipse.org/downloads/packages/eclipse-ide-java-developers/junor


原文:http://xiaoruoen.blog.51cto.com/4828946/872274

posted on 2012-08-03 14:59  siwei1988  阅读(965)  评论(0编辑  收藏  举报