Reference http://blog.csdn.net/yundixiaoduo/article/details/7451753
In fact, you can simply look at this big brother's blog. It's very detailed and the test is OK. Write it down, but I want to record it ~
1. Decompress hadoop 1.0.4. I don't know why contrib built in the source code does not have Eclipse plug-ins, so I have to compile it myself ......
2. Create a Java project in eclipse.
3. Drag all eclipse-plugin files under SCR in the decompressed hadoop
Yes, that's all. Drag it to the project you just created.
4. the build. xml file in the above-level Directory should also be placed in the project ~
5. Configure the compilation path. Because I am a Ubuntu system, directly configure the following, under the project, right-click build path-> Configure build path-> Add library-> eclipse plugin dependencies-> next-> finish
6. The build-contrib.xml is as follows.
<property name="hadoop.root" location="/home/himiko/Downloads/hadoop-1.0.4"/> <property name="eclipse.home" location="/home/himiko/ProgramFiles/eclipse"/> <property name="version" value="1.0.4"/>
Note that you should write these items as per your own !!!!
<project name="hadoopbuildcontrib" xmlns:ivy="antlib:org.apache.ivy.ant"> <property name="name" value="${ant.project.name}"/> <property name="root" value="${basedir}"/> <property name="hadoop.root" location="/home/himiko/Downloads/hadoop-1.0.4"/> <property name="eclipse.home" location="/home/himiko/ProgramFiles/eclipse"/> <property name="version" value="1.0.4"/>
7. Modify buid. XML as follows:
Find this part and modify it (the red letter is modified)
<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="build/ivy/lib/Hadoop/common/commons-cli-${commons-cli.version}.jar" todir="${build.dir}/lib" verbose="true"/> <copy file="${hadoop.root}/lib/commons-configuration-1.6.jar" tofile="${build.dir}/lib/commons-configuration-1.6.jar" verbose="true"/> <copy file="${hadoop.root}/lib/commons-httpclient-3.0.1.jar" tofile="${build.dir}/lib/commons-httpclient-3.0.1.jar" verbose="true"/> <copy file="${hadoop.root}/lib/jackson-core-asl-1.8.8.jar" tofile="${build.dir}/lib/jackson-core-asl-1.8.8.jar" verbose="true"/> <copy file="${hadoop.root}/lib/jackson-mapper-asl-1.8.8.jar" tofile="${build.dir}/lib/jackson-mapper-asl-1.8.8.jar" verbose="true"/> <copy file="${hadoop.root}/lib/commons-lang-2.4.jar" tofile="${build.dir}/lib/commons-lang-2.4.jar" 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>
Note that the line in red is added.
project default="jar" name="eclipse-plugin"><import file="build-contrib.xml"/>
Note that the red part is modified
Add the following code before the end of the file
<path id="hadoop-jars"> <fileset dir="${hadoop.root}/"> <include name="hadoop-*.jar"/> </fileset> </path>
8. Copy two jar packages that do not exist to the folder under which hadoop is decompressed. The name and path are as follows. If there is no folder, create a folder. Build is the new folder ............
The jar package of commons is in the decompressed Lib.
9. Modify the files in the META-INF as follows
Bundle-ClassPath: classes/, lib/hadoop-core.jar, lib/commons-cli-1.2.jar, lib/commons-configuration-1.6.jar, lib/ jackson-core-asl-1.8.8.jar, lib/commons-httpclient-3.0.1.jar, lib/jackson-mapper-asl-1.8.8.jar, lib/commons-lang-2.4.jar,
Right-click build. xml and run as ant build
10. After compilation is successful
Copy the jar package to the Eclipse plug-in directory.
The compiled file has been uploaded ~~~
Configured: