hadoop1.2.1编译eclipse插件

转载自http://blog.csdn.net/duotiger/article/details/11518575


插件源代码在hadoop/src/contrib/eclipse-plugin下面,需要修改build.xml文件如下:

[html]  view plain copy
  1. <?xml version="1.0" encoding="UTF-8" standalone="no"?>  
  2.    
  3. <!--  
  4.    Licensed to the Apache Software Foundation (ASF) under one or more  
  5.    contributor license agreements.  See the NOTICE file distributed with  
  6.    this work for additional information regarding copyright ownership.  
  7.    The ASF licenses this file to You under the Apache License, Version 2.0  
  8.    (the "License"); you may not use this file except in compliance with  
  9.    the License.  You may obtain a copy of the License at  
  10.    
  11.        http://www.apache.org/licenses/LICENSE-2.0  
  12.    
  13.    Unless required by applicable law or agreed to in writing, software  
  14.    distributed under the License is distributed on an "AS IS" BASIS,  
  15.    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
  16.    See the License for the specific language governing permissions and  
  17.    limitations under the License.  
  18. -->  
  19.    
  20. <project default="jar" name="eclipse-plugin">  
  21. <property name="name" value="${ant.project.name}" />  
  22. <property name="root" value="${basedir}" />  
  23. <property name="hadoop.root" location="E:/hadoop-1.2.1" />  
  24. <property name='version' value='1.2.1' />  
  25. <property name='eclipse.home' location='D:/eclipse' />  
  26. <property name="build.dir" location="${hadoop.root}/build/contrib/${name}" />  
  27. <property name="build.classes" location="${build.dir}/classes" />  
  28. <property name="src.dir" location="${root}/src/java" />  
  29.   <!--import file="../build-contrib.xml"/-->  
  30.      
  31.    
  32.   <path id="eclipse-sdk-jars">  
  33.     <fileset dir="${eclipse.home}/plugins/">  
  34.       <include name="org.eclipse.ui*.jar"/>  
  35.       <include name="org.eclipse.jdt*.jar"/>  
  36.       <include name="org.eclipse.core*.jar"/>  
  37.       <include name="org.eclipse.equinox*.jar"/>  
  38.       <include name="org.eclipse.debug*.jar"/>  
  39.       <include name="org.eclipse.osgi*.jar"/>  
  40.       <include name="org.eclipse.swt*.jar"/>  
  41.       <include name="org.eclipse.jface*.jar"/>  
  42.    
  43.       <include name="org.eclipse.team.cvs.ssh2*.jar"/>  
  44.       <include name="com.jcraft.jsch*.jar"/>  
  45.     </fileset>  
  46.   </path>  
  47.    
  48.   <!-- Override classpath to include Eclipse SDK jars -->  
  49.   <path id="classpath">  
  50.     <pathelement location="${build.classes}"/>  
  51.     <pathelement location="${hadoop.root}/build/classes"/>  
  52.     <path refid="eclipse-sdk-jars"/>  
  53.     <fileset dir="${hadoop.root}">     
  54.        <include name="*.jar"/>     
  55.     </fileset>  
  56.   </path>  
  57.    
  58.   <!-- Skip building if eclipse.home is unset. -->  
  59.   <target name="check-contrib" unless="eclipse.home">  
  60.     <property name="skip.contrib" value="yes"/>  
  61.     <echo message="eclipse.home unset: skipping eclipse plugin"/>  
  62.   </target>  
  63.    
  64.  <target name="compile">  
  65.     <echo message="contrib: ${name}"/>  
  66.     <javac  
  67.      encoding="ISO-8859-1"  
  68.      srcdir="${src.dir}"  
  69.      includes="**/*.java"  
  70.      destdir="${build.classes}"  
  71.      debug="on"  
  72.      deprecation="off">  
  73.      <classpath refid="classpath"/>  
  74.     </javac>  
  75.   </target>  
  76.    
  77.   <!-- Override jar target to specify manifest -->  
  78.   <target name="jar" depends="compile" unless="skip.contrib">  
  79.     <mkdir dir="${build.dir}/lib"/>  
  80.     <copy file="${hadoop.root}/hadoop-core-${version}.jar" tofile="${build.dir}/lib/hadoop-core.jar" verbose="true"/>  
  81.     <copy file="${hadoop.root}/lib/commons-cli-1.2.jar"  todir="${build.dir}/lib" verbose="true"/>  
  82.     <copy file="${hadoop.root}/lib/commons-configuration-1.6.jar" todir="${build.dir}/lib" verbose="true" />  
  83.     <copy file="${hadoop.root}/lib/commons-httpclient-3.0.1.jar" todir="${build.dir}/lib" verbose="true" />  
  84.     <copy file="${hadoop.root}/lib/jackson-core-asl-1.8.8.jar" todir="${build.dir}/lib" verbose="true" />  
  85.     <copy file="${hadoop.root}/lib/commons-lang-2.4.jar" todir="${build.dir}/lib" verbose="true" />  
  86.     <copy file="${hadoop.root}/lib/jackson-mapper-asl-1.8.8.jar" todir="${build.dir}/lib" verbose="true" />  
  87.     <jar  
  88.       jarfile="${build.dir}/hadoop-${name}-${version}.jar"  
  89.       manifest="${root}/META-INF/MANIFEST.MF">  
  90.       <fileset dir="${build.dir}" includes="classes/ lib/"/>  
  91.       <fileset dir="${root}" includes="resources/ plugin.xml"/>  
  92.     </jar>  
  93.   </target>  
  94.    
  95. </project>  

MANIFEST.MF修改为:

[html]  view plain copy
  1. Manifest-Version: 1.0  
  2. Bundle-ManifestVersion: 2  
  3. Bundle-Name: MapReduce Tools for Eclipse  
  4. Bundle-SymbolicName: org.apache.hadoop.eclipse;singleton:=true  
  5. Bundle-Version: 0.18  
  6. Bundle-Activator: org.apache.hadoop.eclipse.Activator  
  7. Bundle-Localization: plugin  
  8. Require-Bundle: org.eclipse.ui,  
  9.  org.eclipse.core.runtime,  
  10.  org.eclipse.jdt.launching,  
  11.  org.eclipse.debug.core,  
  12.  org.eclipse.jdt,  
  13.  org.eclipse.jdt.core,  
  14.  org.eclipse.core.resources,  
  15.  org.eclipse.ui.ide,  
  16.  org.eclipse.jdt.ui,  
  17.  org.eclipse.debug.ui,  
  18.  org.eclipse.jdt.debug.ui,  
  19.  org.eclipse.core.expressions,  
  20.  org.eclipse.ui.cheatsheets,  
  21.  org.eclipse.ui.console,  
  22.  org.eclipse.ui.navigator,  
  23.  org.eclipse.core.filesystem,  
  24.  org.apache.commons.logging  
  25. Eclipse-LazyStart: true  
  26. Bundle-ClassPath: classes/,lib/hadoop-core.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, lib/commons-httpclient-3.0.1.jar,lib/commons-cli-1.2.jar  
  27. Bundle-Vendor: Apache Hadoop  

在hadoop目录下新建build/contrib/eclipse-plugin/classes目录。

ant编译,在build/contrib/eclipse-plugin/下面会生成hadoop-eclipse-plugin-1.2.1.jar文件,复制到eclipse的plugin目录下即可

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值