因爲在eclipse下開發hadoop 程序須要插件支持,並且hadoop報下已經沒有插件了,因此須要咱們本身編譯,操做步驟以下app
1.進入D:\hadoop-1.2.1\src\contrib目錄,找到build-contrib.xml文件 ,將hadoop.root改成hadoop解壓目錄。less
<property name="hadoop.root" location="D:\hadoop-1.2.1"/>
eclipse
在下面添加以下兩行:Eclipse安裝根目錄,和hadoop版本。ide
<property name="eclipse.home" location="D:\eclipse"/>
<property name="version" value="1.2.1"/>oop
2. 修改 D:\hadoop-1.2.1\src\contrib\eclipse-plugin下的build.xml文件 (紅色部分爲新增)ui
<target name="jar" depends="compile" unless="skip.contrib">
<mkdir dir="${build.dir}/lib"/>
<copy file="${hadoop.root}/hadoop-core-${version}.jar" tofile="${build.dir}/lib/hadoop-core.jar" verbose="true"/>
<copy file="${hadoop.root}/lib/commons-cli-1.2.jar" todir="${build.dir}/lib" verbose="true"/>
<copy file="${hadoop.root}/lib/commons-configuration-1.6.jar" todir="${build.dir}/lib" verbose="true"/>
<copy file="${hadoop.root}/lib/commons-httpclient-3.0.1.jar" todir="${build.dir}/lib" verbose="true"/>
<copy file="${hadoop.root}/lib/commons-lang-2.4.jar" todir="${build.dir}/lib" verbose="true"/>
<copy file="${hadoop.root}/lib/jackson-core-asl-1.8.8.jar" todir="${build.dir}/lib" verbose="true"/>
<copy file="${hadoop.root}/lib/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>spa
找到<path id="classpath">標籤,下面加入插件
<pathelement location="${hadoop.root}/hadoop-core-1.2.1.jar"/>xml
3. 修改MANIFEST.MF文件。目錄:D:\hadoop-1.2.1\src\contrib\eclipse-plugin\META-INFip
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
4.進入hadoop目錄D:\hadoop-1.2.1\src\contrib\eclipse-plugin,使用Ant進行編譯,最後在D:\hadoop-1.21\build\contrib\eclipse-plugin下面找到你的插件,將插件複製到eclipse/plugin目錄下,重啓。