Note: The following operations are based on Hadoop-1.2.1,eclipse Luna
1. Download Plugin Source Package
Https://github.com/winghc/hadoop2x-eclipse-plugin
2. Create a new ECLISEP Java project to copy the contents of the following directory in the package into project
Hadoop2x-eclipse-plugin-master.zip\hadoop2x-eclipse-plugin-master\src\contrib\eclipse-plugin
3. Increase the dependency library
Where the hadoop-2.4.1 jar comes from the Hadoop home directory
\hadoop-2.4.1\share\hadoop\
Plug-in dependencies add a custom library directly
4, modify the Build.xml
<?xml version= "1.0" encoding= "UTF-8" standalone= "no"?><!-- licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. see the notice file distributed with this work for additional information regarding copyright ownership. the asf licenses this file to you under the apache license, version 2.0 (the " License "); you may not use this file except in compliance With the license. you may obtain a copy of the license at http://www.apache.org/licenses/license-2.0 unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "as is " BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY kind, either express or implied. see the license for the specific language governing permissions and limitations Under the license.--><project name= "Eclipse-plugin" default= "Jar" > <!-- Here's the path to change! --> <property name= "Jdk.home" value= "d:/program files/java/jdk1.7.0_60" / > <property name= "Hadoop.version" value= "2.4.1" /> <property name= " Hadoop.home " value=" d:/lab/lib/hadoop/hadoop-2.4.1 " /> <property name=" EClipse.version " value=" 4.4 " /> <property name=" Eclipse.home " value=" D:/Program files/eclipse/eclipse-jee-luna-r-win32-x86_64 " /> <property name=" root " value= "${basedir}" /> <property file= "${root}/build.properties" /> <property name= "name" value= "${ant.project.name}" /> <property name= "Src.dir" location= "${root}/src/java" /><!-- Note this is Maven's way! --> <property name= "Build.contrib.dir" location= "${root}/build/contrib" /> <property name= "Build.dir" location= "${build.contrib.dir}/${name}" /> <property name= "build.classes" location= "${build.dir}/classes" /> <!-- all jars together --> <property name= "Javac.deprecation" value= "Off" / > <property name= "Javac.debug" value= "on" &NBSP;/≫ <!--<property name= "build.encoding" value= "Iso-8859-1" />--> < Property name= "build.encoding" value= "UTF-8" /><!-- is to UTF-8!--> < Path id= "Eclipse-sdk-jars" > <fileset dir= "${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 name= "Org.eclipse.swt*.jar" /> < Include name= "Org.eclipse.jface*.jar" /> <include name= " Org.eclipse.team.cvs.ssh2*.jar " /> <include name= "Com.jcraft.jsch*.jar" /> </fileset> </path> <path id= "Project-jars" > <fileset file= "${build.dir}/lib/*.jar" /> </path> <target name= "clean" > <echo message= "contrib: ${ Name} " /> <delete dir=" ${build.dir} " /> </target> <target name= "Init" unless= "Skip.contrib" > <echo message= " Contrib: ${name} " /> <mkdir dir=" ${build.dir} " /> <mkdir dir= "${build.classes}" /> <mkdir dir= "${build.dir}/lib" /> <copy todir= "${build.dir}/lib/" verbose= "true" > <fileset dir= "$ {hadoop.home}/share/hadoop/mapreduce "> <include name=" Hadoop*.jar " / > &lT;exclude name= "*test*" /> <exclude name= "*example*" /> </fileset> <fileset dir= "${hadoop.home}/share/hadoop/common" > <include name= "Hadoop*.jar" /> <exclude name= "*test*" /> <exclude name= "*example*" /> </fileset> <fileset dir= "${hadoop.home}/share/hadoop/hdfs" > <include name= "Hadoop*.jar" /> <exclude name= "*test*" /> <exclude name= "*example*" /> </ Fileset> <fileset dir= "${hadoop.home}/share/hadoop/yarn" > <include name= "Hadoop*.jar" /> <exclude name= "*test*" /> <exclude name= "*example*" /> </fileset> < Fileset dir= "${hadoop.home}/share/hadoop/common/lib" > <include name= " Protobuf-java-*.jar " /> <include name=" Log4j-*.jar " /> <include name= "Commons-cli-*.jar" /> <include name= "Commons-collections-*.jar" /> <include name= " Commons-configuration-*.jar " /> <include name=" Commons-lang-*.jar " /> <include name= "Jackson-core-asl-*.jar" /> <include name= "Jackson-mapper-asl-*.jar" /> <include name = "Slf4j-log4j12-*.jar" /> <include name= "Slf4j-api-*.jar" /> <include name= "Guava-*.jar" /> <include name= "Hadoop-annotations-*.jar" /> <include name= "Hadoop-auth-*.jar" /> < Include name= "Commons-cli-*.jar" /> <include name= "Netty-*.jar" /> </fileset> </copy> </target> < Target name= "Compile" depends= "init" unless= "Skip.contrib" > <echo message = "Contrib: ${name}" /> <javac fork= "true" executable= "${jdk.home}/bin/ Javac " encoding=" ${build.encoding} " srcdir=" ${src.dir} " includes=" **/*.java " destdir=" ${ build.classes} " debug=" ${javac.debug} " deprecation=" ${javac.deprecation} " includeantruntime=" on "> <classpath refid=" Eclipse-sdk-jars " /> <classpath refid= "Project-jars" /> </javac> </target> <target name= "Jar" depends= " Compile " unless=" Skip.contrib "> <pathconvert property=" Mf.classpath " pathsep=" , lib/"> <path refid=" Project-jars " /> <flattenmapper /> </pathconvert> <jar jarfile= "${build.dir}/hadoop-${ Hadoop.version}-eclipse-${eclipse.version}-plugin.jar " manifest=" ${root}/meta-inf/manifest. MF "> <manifest> <attribute name=" Bundle-ClassPath " value= "Classes/,lib/${mf.classpath}" /> </manifest> < Fileset dir= "${build.dir}" includes= "classes/ lib/" /> <fileset dir= "${root}" includes= "Resources/ plugin.xml" /> </jar> </ Target></project>
5. Run as Ant Build on the Build.xml file
Buildfile: d:\lab\ws-back-end\hadoop2x-eclipse-plugin\build.xmlinit: [echo] contrib: eclipse-plugin [mkdir] created dir: d:\lab\ ws-back-end\hadoop2x-eclipse-plugin\build\contrib\eclipse-plugin [mkdir] created dir: D:\Lab\ws-back-end\Hadoop2x-eclipse-plugin\build\contrib\eclipse-plugin\classes [mkdir] created dir: d:\lab\ws-back-end\hadoop2x-eclipse-plugin\build\contrib\ Eclipse-plugin\lib [copy] copying 35 files to d:\lab\ ws-back-end\hadoop2x-eclipse-plugin\build\contrib\eclipse-plugin\lib [copy] Copying d:\lab\lib\hadoop\hadoop-2.4.1\share\hadoop\common\lib\commons-cli-1.2.jar to d:\lab\ ws-back-end\hadoop2x-eclipse-plugin\build\contrib\eclipse-plugin\lib\commons-cli-1.2.jar [copy] copying d:\lab\lib\hadoop\hadoop-2.4.1\share\hadoop\common\lib\commons-collections-3.2.1.jar to d:\lab\ ws-back-end\hadoop2x-eclipse-plugin\build\contrib\eclipse-plugin\lib\commons-collections-3.2.1.jar [copy] copying d:\lab\lib\hadoop\hadoop-2.4.1\share\hadoop\common\lib\ Commons-configuration-1.6.jar to d:\lab\ws-back-end\hadoop2x-eclipse-plugin\build\contrib\ eclipse-plugin\lib\commons-configuration-1.6.jar omitted a number of words here ......... .............. Compile: [echo] contrib: eclipse-plugin [javac] compiling 45 source files to d:\lab\ws-back-end\hadoop2x-eclipse-plugin\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 input files are used withoutCheck or unsafe operation. [javac] Note: For more information, please use -Xlint:unchecked recompile. Jar: [jar] building jar: d:\lab\ws-back-end\ hadoop2x-eclipse-plugin\build\contrib\eclipse-plugin\hadoop-2.4.1-eclipse-4.4-plugin.jarinit: [echo] contrib: eclipse-plugincompile: [echo] Contrib: eclipse-pluginbuild successfultotal time: 11 seconds
6. Find a compiled jar here
Compiling hadoop2.x's eclipse plugin using eclipse&ant