Get ready
Eclipse
ant1.8.0
hadoop1.2.1 SRC
Steps
1. Modify/home/hadoop/hadoop-1.2.1/src/contrib/build-contrib.xml
Modify the Hadop.root value to the actual Hadoop root directory
<property name= "Hadoop.root" location= "/home/hadoop/hadoop-1.2.1"/>
Add Eclipse Dependencies
<property name= "Eclipse.home" location= "/home/hadoop/eclipse"/>
Set the version number
<property name= "version" value= "1.2.1"/>
Enable Javac.deprecation
<property name= "Javac.deprecation" value= "on"/>
The ant 1.8+ version requires additional settings Javac includeantruntime= "on" parameter
2. Modify/home/hadoop/hadoop-1.2.1/src/contrib/eclipse-plugin/build.xml
Add to:
<path id= "Hadoop-jars" > <fileset dir= "${hadoop.root}/" > <include name= "Hadoop-*.jar"/> </fileset> </path>
Add in Classpath settings
<path id= "Classpath" > <pathelement location= "${build.classes}"/> <pathelement location= "${ Hadoop.root}/build/classes "/> <path refid=" Eclipse-sdk-jars "/> <!--Add the following line-- <path Refid= "Hadoop-jars"/> </path>
Modify <target name= "jar" depends= "compile" unless= "Skip.contrib" >
<target name= "Jar" depends= "compile" unless= "Skip.contrib" > <mkdir dir= "${build.dir}/lib"/> <copy fil E= "${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= "${ha Doop.root}/lib/commons-lang-2.4.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/ Jackson-mapper-asl-1.8.8.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/ Commons-httpclient-3.0.1.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=" Resourc Es/plugin.xml "/> </jar> </target>
3. Modify the/home/hadoop/hadoop-1.2.1/src/contrib/eclipse-plugin/meta-inf/manifest. Mf
Modify Bundle-classpath:classes to
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. Run Ant
$/home/hadoop/apache-ant-1.8.0/bin/ant
After success, you will see the following prompt:
[Jar] Building jar:/home/hadoop/hadoop-1.2.1/build/contrib/eclipse-plugin/hadoop-eclipse-plugin-1.2.1.jarbuild Successfultotal time:3 seconds
Copy the generated plug-in to Eclipse's plugins directory
Eclipse compiles Hadoop plug-ins