Hadoop Eclipse plug-in generation

Source: Internet
Author: User
Tags echo message

Hadoop Eclipse plug-in generation

Do a year of Hadoop development, has not actively generated eclipse plug-in, has been on the Internet to download other people's use, there is time today, this part of the regret to fill back, their own generation, nonsense not to say, began.

I. Environmental description

The Hadoop Eclipse plug-in in this column is generated through Eclipse (unused command generation is due to some of the problems that occur during the generation of plug-ins with commands, are not easy to see and modify, are intuitive with eclipse, easy error correction), where the Hadoop version is 1.2.1 ( Stable version), the operating system is centos,ide for MyEclipse 2013 (same with Eclipse, no difference). The following hadoop_home represents the installation directory for Hadoop.


Second, plug-in generation

1. Import the $hadoop_home/src/contrib/eclipse-plugin into the Eclipse project .

In this example, import the/opt/hadoop-1.2.1/src/contrib/eclipse-plugin directory into eclipse.


If the project name is "Mapreducetools" after the addition is completed, such as:



2. Add Hadoop-core-1.2.1.jar to environment variables

Right-click the project-->build path-->configure BuildPath, delete the existing Hadoop-core jar package (the default package is not already in classpath), and then $hadoop_home/ Hadoop-core-1.2.1.jar joined Classpath.



3. Modify each configuration file:

(1). Modify Build.properties:

Add the installation directory for Eclipse and the Hadoop version number, as in the reference below

Eclipse.home = your Eclipse installation directory
Version = your Hadoop build number

The individual modified documents are as follows:

#add by Jack Zhueclipse.home =/opt/myeclipse-2013version = 1.2.1#add by Jack Zhuoutput. = Bin/bin.includes = meta-inf/,plugin.xml,resources/,classes/,classes/,lib/               plugin.xml,               resources/,               classes/,               classes/,               lib/

(2). Modify Build.xml:

The document needs to be modified in three places, which are located in the middle of the two "<!--add by zhu-->" marks, as follows:

<project default= "jar" name= "Eclipse-plugin" > <import file= ". /build-contrib.xml "/> <path id=" Eclipse-sdk-jars "> <fileset dir=" ${eclipse.home}/plugins/"> <in Clude name= "Org.eclipse.ui*.jar"/> <include name= "Org.eclipse.jdt*.jar"/> <include name= "Org.eclipse       . Core*.jar "/> <include name=" Org.eclipse.equinox*.jar "/> <include name=" Org.eclipse.debug*.jar "/> <include name= "Org.eclipse.osgi*.jar"/> <include name= "Org.eclipse.swt*.jar"/> <include nam E= "Org.eclipse.jface*.jar"/> <include name= "Org.eclipse.team.cvs.ssh2*.jar"/> <include name= "COM.JCR Aft.jsch*.jar "/> </fileset> </path><!--Add by Zhu (1)--><path id=" Hadoop-lib-jars ">< Fileset dir= "${hadoop.root}/" ><include name= "Hadoop-*.jar"/></fileset></path><!--Add by zhu--> <!--Override classpath to include Eclipse SDK jars---<path id= "CLasspath "> <pathelement location=" ${build.classes} "/> <pathelement location=" ${hadoop.root}/build/   Classes "/> <path refid=" Eclipse-sdk-jars "/> <!--Add by Zhu (2)--<path refid=" Hadoop-lib-jars "/> <!--add by zhu--> </path> <!--Skip Building if Eclipse.home is unset.    --<target name= "Check-contrib" unless= "Eclipse.home" > <property name= "skip.contrib" value= "yes"/> <echo message= "Eclipse.home unset:skipping Eclipse plugin"/> </target> <target name= "Compile" depends= " Init, Ivy-retrieve-common "unless=" Skip.contrib "> <echo message=" contrib: ${name} "/> <javac encoding = "${build.encoding}" srcdir= "${src.dir}" includes= "**/*.java" destdir= "${build.classes}" debug= "${javac.de Bug} "deprecation=" ${javac.deprecation} "> <classpath refid=" classpath "/> </javac> &LT;/TARGET&G  T <!--Override jar target to specify manifest--<Target Name= "jar" depends= "compile" unless= "Skip.contrib" > <mkdir dir= "${build.dir}/lib"/> <!--add by Zhu ( 3)--<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-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 "/> <!--add by zhu--> <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></project>
Note: The above file contents can be copied directly in the past, without any difference.

(3). Modify the Meta-inf/manifest. MF File:

Add the jar package added in the third step of the above step (2) in the file: lib/hadoop-core.jar,lib/commons-configuration-1.6.jar,lib/ commons-httpclient-3.0.1.jar,lib/commons-lang-2.4.jar,lib/jackson-core-asl-1.8.8.jar,lib/ Jackson-mapper-asl-1.8.8.jar

The contents of this document are as follows:

Manifest-version:1.0bundle-manifestversion:2bundle-name:mapreduce Tools for Eclipsebundle-symbolicname: Org.apache.hadoop.eclipse;singleton:=truebundle-version:0.18bundle-activator: Org.apache.hadoop.eclipse.activatorbundle-localization:pluginrequire-bundle:org.eclipse.ui, Org.eclipse.core.runtime, Org.eclipse.jdt.launching, Org.eclipse.debug.core, ORG.ECLIPSE.JDT, Org.eclipse.jdt.core , Org.eclipse.core.resources, Org.eclipse.ui.ide, Org.eclipse.jdt.ui, Org.eclipse.debug.ui, Org.eclipse.jdt.debug.ui, Org.eclipse.core.expressions, Org.eclipse.ui.cheatsheets, Org.eclipse.ui.console, Org.eclipse.ui.navigator, Org.eclipse.core.filesystem, Org.apache.commons.loggingeclipse-lazystart: truebundle-classpath:classes/, lib/hadoop-core.jar,lib/commons-configuration-1.6.jar,lib/ commons-httpclient-3.0.1.jar,lib/commons-lang-2.4.jar,lib/jackson-core-asl-1.8.8.jar,lib/ Jackson-mapper-asl-1.8.8.jarbundle-vendor:apache Hadoop
Note: The above file contents can be copied directly in the past, without any difference.


4. Execute ant in Build.xml to compile and package:

On this page, right-click the-->run as Ant Build


If all goes well, after the ant compilation package is complete, it will be generated in the $hadoop_home/contrib/eclipse-plugin directory Hadoop-eclipse-plugin-1.2.1.jar



5. Place the newly generated jar package in the Dropins directory under Eclipse's installation directory and restart Eclipse

You can then create a new Map/reduce project.



If you don't want to build it yourself, you can download the Hadoop Eclipse plugin I generated: http://download.csdn.net/detail/u012875880/8154149

Hadoop Eclipse plug-in generation

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.