Compile the hadoop-eclipse-plugin-1.0.4.jar package on ubuntu12.04

Source: Internet
Author: User

1. In eclipse, select file --> Import --> existing projects into workspace to import existing projects. Assume that the path is:

$ Hadoop_home/src/contrib/eclipse-plugin. The default project name is mapreducetools.After the import because the hadoop-core.jar package cannot be found, so there is a red exclamation point on the project, don't worry about it [after adding the Lib package will disappear]

 

2. The default project name is mapreducetools,Create the lib directory in the project mapreducetools.First, rename the hadoop-core-1.0.4.jar under hadoop to hadoop. core. jar, and put hadoop. core. jar, and lib directory under the 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 copy to the directory.

 

3. Copy $ hadoop_home/src/contrib/build-contrib.xml (that is, the same level directory as the eclipse-plugin package) to the Eclipse project directory, and modify the build-contrib.xml to put the attribute hadoop. root, Eclipse. switch home to the storage directory on the local computer. Modify the current version of hadoop. Eg:

<Property name = "hadoop. Root" location ="/Home/hadoop/downloads/hadoop-1.0.4"/>
<Property name = "Eclipse. Home" location ="/Home/hadoop/downloads/eclipse"/>

<Property name = "version" value ="1.0.4"/>

 

4. Modify build. xml

<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-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 = "Resources/plugin. xml"/>
</Jar>
</Target>

 

5. Modify the META-INF/manifest. MF file and add the jar package under the lib directory.

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

6. Right-click the project --> export, select JAR file for the type, and setPlugin. xml file, classes directory, lib directory, and Resources DirectorySelect the exported jar directory ,【Note that you should select using exsiting manifest from workspace (that is, you must select the file configured in the previous step) instead of creating a new manifest file.To export the hadoop-eclipse-plugin-1.0.4.jar file. Here, when I export, the compiled class files in the hadoop-eclipse-plugin-1.0.4.jar are not included in the classes directory [which does not have the classes Directory], so first create a classes directory, cut the compiled class file into the classes directory.

 

6, after the above steps, the generated hadoop-eclipse-plugin-1.0.4.jar package can be used. Put the file under the eclipse/plugin directory and restart eclipse.

This is my compiled plug-in: http://pan.baidu.com/share/link? Consumer id = 192371 & UK = 1141105618

Note: compilation methods of other versions can also be implemented through the above steps.


References: http://zhengzhuangjie.iteye.com/blog/1557734

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.