1,、將hadoop解壓,。比如:D:\hadoop-1.0.3,。 2,、進入D:\hadoop-1.0.3\src\contrib目錄。將build-contrib.xml復(fù)制到D:\hadoop-1.0.3\src\contrib\eclipse-plugin目錄下,。 3、修改build-contrib.xml文件: 將hadoop.root改為hadoop解壓目錄,。 <property name=”hadoop.root” location=” D:\hadoop-1.0.3″/> 在下面添加如下兩行:Eclipse安裝根目錄,和hadoop版本,。 <property name=”eclipse.home” location=”D:\eclipse”/> <property name=”version” value=”1.0.3″/> 4、在D:\hadoop-1.0.3\src\contrib\eclipse-plugin 目錄下創(chuàng)建lib目錄,,并將以下jar包復(fù)制進來:commons-configuration-1.6.jar,、commons-httpclient-3.0.1.jar,、commons-lang-2.4.jar jackson-core-asl-1.8.8.jar、jackson-mapper-asl-1.8.8.jar. 5,、在D:\hadoop-1.0.3下創(chuàng)建build文件夾,將hadoop-core-1.0.3.jar復(fù)制進來,。 在D:\hadoop-1.0.3\build目錄下創(chuàng)建D:\hadoop-1.0.3\build\ivy\lib\Hadoop\common目錄并將commons-cli-1.2.jar復(fù)制到該目錄下。 6,、修改build.xml文件,。目錄:D:\hadoop-1.0.3\src\contrib\eclipse-plugin <target name=”jar” depends=”compile” unless=”skip.contrib”> <mkdir dir=”${build.dir}/lib”/> <copy file=”${hadoop.root}/build/hadoop-core-${version}.jar” tofile=”${build.dir}/lib/hadoop-core.jar” verbose=”true”/> <copy file=”${hadoop.root}/build/ivy/lib/Hadoop/common/commons-cli-${commons-cli.version}.jar” todir=”${build.dir}/lib” verbose=”true”/> <copy file=”${hadoop.root}/build/commons-configuration-1.6.jar” todir=”${build.dir}/lib” verbose=”true”/> <copy file=”${hadoop.root}/build/commons-httpclient-3.0.1.jar” todir=”${build.dir}/lib” verbose=”true”/> <copy file=”${hadoop.root}/build/commons-lang-2.4.jar” todir=”${build.dir}/lib” verbose=”true”/> <copy file=”${hadoop.root}/build/jackson-core-asl-1.8.8.jar” todir=”${build.dir}/lib” verbose=”true”/> <copy file=”${hadoop.root}/build/jackson-mapper-asl-1.8.8.jar” todir=”${build.dir}/lib” verbose=”true”/> <jar jarfile=”${build.dir}/hadoop-${name}-${version}.jar” manifest=”${root}/META-INF/MANIFEST.MF”> <fileset dir=”${build.dir}” includes=”classes/ lib/”/> <fileset dir=”${root}” includes=”resources/ plugin.xml”/> </jar> </target> 7、修改:MANIFEST.MF文件。目錄:D:\hadoop-1.0.3\src\contrib\eclipse-plugin\META-INF Bundle-ClassPath那一欄加入如下信息: Bundle-ClassPath: classes/, lib/hadoop-core.jar, lib/commons-cli-1.2.jar, lib/commons-configuration-1.6.jar, lib/commons-httpclient-3.0.1.jar, lib/commons-lang-2.4.jar, lib/commons-jackson-core-asl-1.8.8.jar, lib/commons-jackson-mapper-asl-1.8.8.jar 8、在控制臺切換到目錄D:\hadoop-1.0.3\src\contrib\eclipse-plugin,,使用Ant進行編譯(編譯過程中需要聯(lián)網(wǎng),一些缺少的包會從網(wǎng)上下載),。最后生成的結(jié)果會在D:\hadoop-1.0.3\build\contrib\eclipse-plugin下面。 |
|