(转)使用Ant编译Hadoop eclipse插件
转自 http://xiaoruoen.blog.51cto.com/4828946/872274
进入%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目录下。