bulid hadoop eclipse plugin

测试环境 sts-2.9.2.RELEASE(eclipse3.7.2) 和hadoop1.0.3

配置ant环境 

1.进入${hadoop-home}\src\contrib\eclipse-plugin目录

       修改eclipse-plugin\build.properties

output.. = bin/
bin.includes = META-INF/,\
               plugin.xml,\
               resources/,\
               classes/,\
               classes/,\
               lib/
eclipse.home = D:/work/springsource/sts2.9/sts-2.9.2.RELEASE
version = 1.0.3

   

    拷贝   ${hadoop-home}\hadoop*.jar 到eclipse/plugins下

    修改eclipse-plugin\build.xml

<project default="jar" name="eclipse-plugin">
.
.
.
  <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"/>	  
      <include name="hadoop*.jar"/>
    </fileset> 
  </path>
.
.
  <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-core-asl-1.8.8.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/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>
.
.
</project>

修改eclipse-plugin\META-INF\MANIFEST.MF

Manifest-Version: 1.0

Bundle-ManifestVersion: 2

Bundle-Name: MapReduce Tools for Eclipse

Bundle-SymbolicName: org.apache.hadoop.eclipse;singleton:=true

Bundle-Version: 0.18

Bundle-Activator: org.apache.hadoop.eclipse.Activator

Bundle-Localization: plugin

Require-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.logging

Eclipse-LazyStart: true

Bundle-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.jar

Bundle-Vendor: Apache Hadoop

2 CMD 切入在${hadoop-home}\src\contrib\eclipse-plugin 目录执行ant 执行完 会在${hadoop-home}\build\contrib\eclipse-plugin 下生成hadoop-eclipse-plugin-1.0.3.jar

 3 把jar拷入到eclipse/plugins下 即可

相关推荐