使用Ant编译Hadoop1.0.3 eclipse插件

转自:http://xiaoruoen.blog.51cto.com/4828946/872274

下载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

加入

<propertyname="version"value="1.0.3"/>

<propertyname="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

<pathid="eclipse-sdk-jars">

<filesetdir="${eclipse.home}/plugins/">

</fileset>

</path>

中加入

<includename="hadoop*.jar"/>

将compile模块中

deprecation="${javac.deprecation}

去掉。

打开CMD在%Hadoop_HOME%\src\contrib\eclipse-plugin下使用ant

这时开始编译。

jar:[echo]version:1.0.3[copy]Copying1filetoD:\hadoop-1.0.3\build\contrib\eclipse-plugin\lib[copy]CopyingD:\hadoop-1.0.3\build\ivy\lib\Hadoop\common\commons-cli-1.2.jartoD:\hadoop-1.0.3\build\contrib\eclipse-plugin\lib\commons-cli-1.2.jar[jar]Buildingjar:D:\hadoop-1.0.3\build\contrib\eclipse-plugin\hadoop-eclipse-plugin-1.0.3.jarBUILDSUCCESSFULTotaltime:2seconds注意,在编译的过程中可能会报错,主要出在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-openperspective-other,会看到

选择Map/Reduce

选择window-showview-other

选择Map/ReduceLocaions

到这eclipse的hadoop插件就编译成功了

相关推荐