Compiling hadoop1.x's eclipse plugin using eclipse&ant

Source: Internet
Author: User
Tags deprecated

Note: The following operations are based on Hadoop-1.2.1,eclipse Luna

1. Import the Hadoop Eclipse plug-in project into Eclipse. Plugin source directory is as follows:

D:\Lab\lib\hadoop\hadoop-1.2.1\src\contrib\eclipse-plugin

2. Configuration Engineering Dependency

3. Prepare the ant configuration file

D:\Lab\lib\hadoop\hadoop-1.2.1\src\contrib\build-contrib.xml

Copy the above build-contrib.xml into the project directory and modify the contents of the file. Specific as follows:

<property name= "name" value= "${ant.project.name}"/> <property name= "root" value= "${basedir}"/> < Property Name= "Hadoop.root" location= "d:/lab/lib/hadoop/hadoop-1.2.1"/> <property name= "Eclipse.home" location= "D:/program files/eclipse/eclipse-jee-luna-r-win32-x86_64"/> <property name= "version" value= "1.2.1" /> <property name= "Build.contrib.dir" location= "${root}/build/contrib"/> <property name= "Build.dir" location= "${root}/build/contrib/${name}"/>

4, modify the Build.xml

<!-- 1. Modify the position of the  build-contrib.xml and remove the ". /" --><import file=" Build-contrib.xml " /><!-- 2. Add the following, otherwise prompt" package   org.apache.hadoop.fs  does not exist " --><path id=" Hadoop-jars ">    < Fileset dir= "${hadoop.root}/" >        <include name= " Hadoop-*.jar " />    </fileset></path><!-- 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"  />    <path refid= "Hadoop-jars"  /><!-- This behavior adds content--></path><!-- 3. Modify and add the jar package, some of which are already available, with no    --><!-- ovErride jar target to specify manifest --><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/commons-httpclient-3.0.1.jar"  todir= "${build.dir}/lib"   Verbose= "true"  />  &nBsp; <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 " />     <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 MENIFEST.MF, add some dependent jar in the Bundule-classpath.

bundle-classpath:classes/, D:/lab/lib/hadoop/hadoop-1.2.1/lib/hadoop-core-1.2.1.jar, D:/Lab/lib/hadoop/ Hadoop-1.2.1/lib/commons-cli-1.2.jar, D:/lab/lib/hadoop/hadoop-1.2.1/lib/commons-configuration-1.6.jar, D:/Lab/ Lib/hadoop/hadoop-1.2.1/lib/commons-httpclient-3.0.1.jar, d:/lab/lib/hadoop/hadoop-1.2.1/lib/ Commons-lang-2.4.jar, D:/lab/lib/hadoop/hadoop-1.2.1/lib/jackson-core-asl-1.8.8.jar, D:/Lab/lib/hadoop/ Hadoop-1.2.1/lib/jackson-mapper-asl-1.8.8.jar

5. Add Ant Builder.

6. Compiling

Build project in the Project menu

7. Operation Result

buildfile: d:\lab\ws-back-end\mapreducetools\build.xmlcheck-contrib:init:         [echo] contrib: eclipse-plugin       [mkdir]  Created dir: D:\Lab\ws-back-end\MapReduceTools\build\contrib\eclipse-plugin        [mkdir] created dir: d:\lab\ws-back-end\mapreducetools\build\contrib\ Eclipse-plugin\classes       [mkdir] created dir: d:\lab\ Ws-back-end\mapreducetools\build\contrib\eclipse-plugin\test       [mkdir]  Created dir: D:\Lab\ws-back-end\MapReduceTools\build\contrib\eclipse-plugin\system        [mkdir] created dir: d:\lab\ws-back-end\mapreducetools\build\ Contrib\eclipse-plugin\system\classes       [mkdir] created dir:  d:\lab\ws-back-end\mapreducetools\build\contrib\eclipse-plugin\examples       [mkdir]  Created dir: d:\lab\ws-back-end\mapreducetools\build\contrib\eclipse-plugin\test\logsinit-contrib: ivy-download:         [get] getting: http:// repo2.maven.org/maven2/org/apache/ivy/ivy/2.1.0/ivy-2.1.0.jar          [get] To: D:\Lab\lib\hadoop\hadoop-1.2.1\ivy\ivy-2.1.0.jar          [get] http://repo2.maven.org/maven2/org/apache/ivy/ivy/2.1.0/ivy-2.1.0.jar moved  to http://120.195.54.5:801/videoplayer/ivy-2.1.0.jar?ich_u_r_i=ae068fe40ff82e58486dd0954048cc19 &ich_s_t_a_r_t=0&ich_e_n_d=0&ich_k_e_y=1445088923750763152452&ich_t_y_p_e=1&ich_d_i_s_k_i_ d=6&ich_u_n_i_t=1         [get] not modified -  so not downloadedivy-probe-antlib:ivy-init-antlib:ivy-init:[ivy:configure] :: ivy 2.1.0 - 20090925235825  :: http://ant.apache.org/ivy/ ::[ivy:configure] :: loading settings ::  file = d:\lab\lib\hadoop\hadoop-1.2.1\ivy\ivysettings.xmlivy-resolve-common: ivy-retrieve-common:[ivy:cachepath] deprecated:  ' Ivy.conf.file '  is deprecated, use   ' Ivy.settings.file '  instead[ivy:cachepath] :: loading settings :: file  = D:\Lab\lib\hadoop\hadoop-1.2.1\ivy\ivysettings.xmlcompile:         [echo] contrib: eclipse-plugin       [javac] d:\ lab\ws-back-end\mapreducetools\build.xml:65: warning:  ' Includeantruntime '  was not set ,  defaulting to build.sysclasspath=last; set to false for repeatable  builds     &nBsp; [javac] compiling 45 source files to d:\lab\ws-back-end\mapreducetools \build\contrib\eclipse-plugin\classes       [javac]  Note:  Some of the input files use or overwrite obsolete  api.        [javac]  Note:  For more information,  please use  -Xlint:deprecation  Recompile.        [javac]  Note:  Some of the input files use unchecked or unsafe operations.        [javac]  Note:  For more information,  please use  -Xlint:unchecked  Recompile. Jar:       [mkdir] created dir: d:\lab\ws-back-end\ mapreducetools\build\contrib\eclipse-plugin\lib        [copy]  copying 1 file to d:\lab\ws-back-end\mapreducetools\build\contrib\eclipse-plugin\lib         [copy] copying d:\lab\lib\hadoop\hadoop-1.2.1\ Hadoop-core-1.2.1.jar to d:\lab\ws-back-end\mapreducetools\build\contrib\eclipse-plugin\lib\hadoop-core.jar         [copy] copying 1 file to d:\lab\ws-back-end\mapreducetools\build\ Contrib\eclipse-plugin\lib        [copy] copying d:\lab\lib\ Hadoop\hadoop-1.2.1\lib\commons-cli-1.2.jar to d:\lab\ws-back-end\mapreducetools\build\contrib\ Eclipse-plugin\lib\commons-cli-1.2.jar        [copy] copying  1 file to D:\Lab\ws-back-end\MapReduceTools\build\contrib\eclipse-plugin\lib         [copy] copying d:\lab\lib\hadoop\hadoop-1.2.1\lib\ Commons-lang-2.4.jar to d:\lab\ws-back-end\mapreducetools\build\contrib\eclipse-plugin\lib\ commons-lang-2.4.jar        [copy] copying 1 file  To d:\lab\ws-back-end\mapreducetools\build\contrib\eclipse-plugin\lib        [copy] copying d:\lab\lib \hadoop\hadoop-1.2.1\lib\commons-configuration-1.6.jar to d:\lab\ws-back-end\mapreducetools\build\ Contrib\eclipse-plugin\lib\commons-configuration-1.6.jar        [copy]  copying 1 file to d:\lab\ws-back-end\mapreducetools\build\contrib\eclipse-plugin\lib         [copy] copying d:\lab\lib\hadoop\hadoop-1.2.1\lib\ Commons-httpclient-3.0.1.jar to d:\lab\ws-back-end\mapreducetools\build\contrib\eclipse-plugin\lib\ commons-httpclient-3.0.1.jar        [copy] copying 1  file to d:\lab\ws-back-end\mapreducetools\build\contrib\eclipse-plugin\lib         [copy] copying d:\lab\lib\hadoop\hadoop-1.2.1\lib\ Jackson-mapper-asl-1.8.8.jar to d:\lab\ws-back-end\mapreducetools\build\contrib\eclipse-plugin\lib\jackson-mapper-asl-1.8.8.jar         [copy] copying 1 file to d:\lab\ws-back-end\ mapreducetools\build\contrib\eclipse-plugin\lib        [copy]  Copying d:\lab\lib\hadoop\hadoop-1.2.1\lib\jackson-core-asl-1.8.8.jar to d:\lab\ws-back-end\ mapreducetools\build\contrib\eclipse-plugin\lib\jackson-core-asl-1.8.8.jar          [jar] building jar: d:\lab\ws-back-end\mapreducetools\build\contrib\ Eclipse-plugin\hadoop-eclipse-plugin-1.2.1.jarbuild successfultotal time: 6 seconds


Compiling hadoop1.x's eclipse plugin using eclipse&ant

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.