Linux under Hadoop Eclipse plugin compile install __linux

Source: Internet
Author: User

My Hadoop is 1.2.1 version, there are some compiled on the internet Hadoop plug-ins, but still do-it-yourself, ample clothing, later version of the update can compile their own plug-ins, and this will ensure that the installation in eclipse will not have too many problems.

Mainly refer to this article http://www.cnblogs.com/kinuxroot/archive/2013/05/06/linux_hadoop_eclipse_plugin.html

For easy viewing, or paste the information. Statement: I follow the previous explanation part of a little bit of code to add the time did not succeed, the use of the overall file behind, a slight modification after the success, it is really indiscriminate to add is not, after all, the version is not the same, in some places or different.

1. To join Eclipse settings and Hadoop version settings, my eclipse is installed under/home/kinuxroot/apps/eclipse, so we want to change it to:

<property name= "Eclipse.home" location= "/home/kinuxroot/apps/eclipse"/> <property
"version" value= "1.1.2"/>

This step, the path in the location please change according to their actual path.


2. We need to refer to some of the packages of Hadoop, but the default classpath do not have these packages (we did not compile from scratch). So you need to modify the Classpath
Positioning <path id= "Classpath", add:

<fileset dir= "${hadoop.root}" >
    <include name= "**/*.jar"/>
</fileset>

3. Some legacy functions are used in the code, so we need to modify the deprecation settings.
Open the src/contrib/build-contrib.xml below the Hadoop root path to locate

<property name= "javac.deprecation" value= "Off"/>

And then modify it into

<property name= "Javac.deprecation" value= "on"/>

4. Modify the Includeantruntime settings. Locate compile target, modify the Javac settings, and add an option
Includeantruntime= "On"
Which is to modify the Javac into

<javac
     encoding= "${build.encoding}"
     srcdir= "${src.dir}"
     includes= "
     **/*.java" destdir= "${" build.classes} "
     debug=" ${javac.debug} "
     deprecation= ${javac.deprecation}"
     includeantruntime= "on" >
     <classpath refid= "classpath"/>
</javac>

5.jar needed some jar files for Hadoop, but we didn't compile it, so we need to modify the jar target.

In addition, there are a few jars we need to use, and Build.xml does not contain automatically, if not included, Eclipse connect Hadoop will appear failure to login error, in fact, can not find the class
Found it

<copy file= "${hadoop.root}/build/hadoop-core-${version}.jar" tofile= "${build.dir}/lib/hadoop-core.jar" verbose = ' true '/>
<copy file= ' ${hadoop.root}/build/ivy/lib/hadoop/common/commons-cli-${commons-cli.version}. Jar "  todir=" ${build.dir}/lib "verbose= true"/>

We modify into

<copy file= ' ${hadoop.root}/hadoop-core-${version}.jar ' tofile= ' ${build.dir}/ Lib/hadoop-core.jar "verbose=" true "/> <copy file=" ${hadoop.root}/lib/commons-cli-${commons-cli.version}.jar "Tofile=" ${build.dir}/lib/commons-cli.jar "verbose=" true "/> <copy file=" ${hadoop.root}/lib/ Commons-configuration-1.6.jar "tofile=" ${build.dir}/lib/commons-configuration.jar "verbose=" true "/> <copy File= "${hadoop.root}/lib/commons-httpclient-3.0.1.jar" tofile= "${build.dir}/lib/commons-httpclient.jar" verbose= "True"/> <copy file= "${hadoop.root}/lib/commons-lang-2.4.jar" tofile= "${build.dir}/lib/commons-lang.jar" Verbose= "true"/> <copy file= ${hadoop.root}/lib/jackson-core-asl-1.8.8.jar "tofile=" ${build.dir}/lib/ Jackson-core-asl.jar "verbose=" true "/> <copy file=" ${hadoop.root}/lib/jackson-mapper-asl-1.8.8.jar "tofile=" ${build.dir}/lib/jackson-mapper-asl.jar "verbose= true"/> 

6. However, our jar files are not automatically deployed to eclipse, you can copy them manually, but we want ant to help us deploy them automatically.
We create a new target to deploy:

<target name= "Deploy" depends= "jar" unless= "Skip.contrib" > <copy file= "${build.dir}/hadoop-${name}-${"
Version}.jar "  todir=" ${eclipse.home}/plugins "verbose=" true "/>
</target>

Then modify project's default target, which is to modify project to:

<project default= "Deploy" name= "Eclipse-plugin" >

7. The next step is to modify the src/contrib/eclipse-plugin/meta-info/manifest in the Hadoop root directory. MF, modify the classpath of this jar.

Find this line of Bundle-classpath for this file, and then, modify it into

bundle-classpath:classes/,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

8. Execute ant, the code will be compiled, the plug-in will be automatically installed into Eclipse's plugins directory, open eclipse will be available (if Ant is not installed,
Go to Apache and wait and see to download the binary version of Ant. In addition, the compilation will automatically download the required package, so please ensure the network unobstructed.

Finally, I put my build.xml on the following, you can refer to:

<?xml version= "1.0" encoding= "UTF-8" standalone= "no"?> <!--licensed to the Apache Software Foundation (ASF)  Under one or more contributor license agreements.
   The NOTICE file distributed with this work for additional information regarding copyright. The ASF licenses this file to you under the Apache License, Version 2.0 (the "License");  You are not to use this file except in compliance with the License. Obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 unless required by applicab Le or agreed to in writing, software distributed under the License was distributed on ' as is ' basis, without W
   Arranties or CONDITIONS of any KIND, either express OR implied.
The License for the specific language governing permissions and limitations under the License. --> <project default= "Deploy" name= "Eclipse-plugin" > <import file= ". /build-contrib.xml "/> <property name=" eclipse. Home "location="/home/kinuxroot/apps/eclipse "/><!--here Location the Eclipse installation path of the cost-change machine--> <property" Version "value=" 1.1.2 "/><!--Here's the information to be changed to be the same as myself, I made a mistake here--> <path id=" Eclipse-sdk-jars "> <fileset di R= "${eclipse.home}/plugins/" > <include 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 na Me= "Org.eclipse.swt*.jar"/> <include name= "Org.eclipse.jface*.jar"/> <
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.