准备
eclipse
ant1.8.0
hadoop1.2.1 src
步骤
1. 修改/home/hadoop/hadoop-1.2.1/src/contrib/build-contrib.xml
修改hadop.root值为实际的hadoop根目录
<property name="hadoop.root" location="/home/hadoop/hadoop-1.2.1"/> 添加eclipse依赖 <property name="eclipse.home" location="/home/hadoop/eclipse" /> 设置版本号 <property name="version" value="1.2.1"/> 启用javac.deprecation <property name="javac.deprecation" value="on"/> ant 1.8+ 版本需要额外的设置javac includeantruntime=“on” 参数 2. 修改/home/hadoop/hadoop-1.2.1/src/contrib/eclipse-plugin/build.xml添加:
在classpath设置中添加
修改<target name="jar" depends="compile" unless="skip.contrib">
3. 修改/home/hadoop/hadoop-1.2.1/src/contrib/eclipse-plugin/META-INF/MANIFEST.MF
修改Bundle-ClassPath: classes为
Bundle-ClassPath: classes/, lib/hadoop-core.jar, lib/commons-cli.jar, lib/commons-httpclient.jar, lib/hadoop-core.jar, lib/jackson-mapper-asl.jar, lib/commons-configuration.jar, lib/commons-lang.jar, lib/jackson-core-asl.jar
4. 运行ant
$ /home/hadoop/apache-ant-1.8.0/bin/ant
成功后会看到如下提示:
[jar] Building jar: /home/hadoop/hadoop-1.2.1/build/contrib/eclipse-plugin/hadoop-eclipse-plugin-1.2.1.jarBUILD SUCCESSFULTotal time: 3 seconds
将生成的插件复制到eclipse的plugins目录下
5. 配置eclipse