Hadoop1.2 eclipse plug-in compilation
Catalog description
Before compiling, we need to download the source file of hadoop 1.2.1 and extract it to the appropriate location. The directory structure is as follows:
Eclipse: d:\ eclipse
Hadoop: d:\ hadoop-1.2.1
Step1 Import Hadoop-eclipse plug-in Project
1. Download hadoop-1.2.1.tar.gz and extract it to the root directory of disk D.
two。 Select File- > Import- > General/Existing Projectsinto Workspace in Eclipse to import Hadoop's Eclipse plug-in project. Select the path D:\ hadoop-1.2.1\ src\ contrib\ eclipse-plugin, and then click Finish. Its default project name is MapReduceTools. (it is best to extract the file and import it)
Step2 imports required jar packages
Create a new lib directory in the project MapReduceTools, and copy the hadoop-core-1.2.1.jar under hadoop-1.2.1 (renamed to hadoop-core.jar) and its commons-cli-1.2.jar, commons-lang-2.4.jar, commons-configuration-1.6.jar, jackson-mapper-asl-1.8.8.jar, jackson-core-asl-1.8.8.jar, commons-httpclient-3.0.1.jar under the lib directory to this directory.
Step3 modifies build-contrib.xml
Copy the build-contrib.xml file under the D:\ hadoop-1.2.1\ src\ contrib directory to the project directory, note: copy the build-contrib.xml file to the first-level directory of the current project, and modify the build-contrib.xml file after the copy is completed. The changes are as follows.
Step4 modifies build.xml
Step5 modifies MANIFEST.MF
Add the following to Bundle-ClassPath.
Bundle-ClassPath: classes/
Lib/hadoop-core.jar
Lib/commons-cli-1.2.jar
Lib/commons-httpclient-3.0.1.jar
Lib/jackson-core-asl-1.8.8.jar
Lib/jackson-mapper-asl-1.8.8.jar
Lib/commons-configuration-1.6.jar
Lib/commons-lang-2.4.jar
Step6Ant compiles 1. Right-click the MapReduceTools project, Properties- > Builders- > New- > Ant Builder
two。 Modify the contents of the New_Builder editing interface
Name (see name): plugin_Builder
Buildfile (location of build.xml): d:\ hadoop-1.2.1\ src\ contrib\ eclipse-plugin\ build.xml
3. Modification completed and saved
4. Click Project- > Build Project to generate
Click Project- > Build Project to start the generation. At this time, we will see the console output a bunch of relevant compilation information, and if the compilation is successful, we will see the output of BUILD SUCCESSFUL in the console. The compilation results are in the d:\ hadoop-1.2.1\ build\ contrib\ eclipse-plugin directory.
Step6 to view the compilation results
The compilation results are in the d:\ hadoop-1.2.1\ build\ contrib\ eclipse-plugin directory. We can see that hadoop-eclipse-plugin-1.2.1.jar is generated in the directory, so if we need to install the plug-in to eclipse, we need to put hadoop-eclipse-plugin-1.2.1.jar into the plugins directory of eclipse and restart eclipse.