从hadoop 0.20.203以后,hadoop的发布包里,不再对eclipse插件进行jar包发布,而是给出了打包的代码,需要各位开发人员自己进行打包和设置。我们打的包必须跟自己使用的hadoop版本一致

第一步:先下载hadoop版本,我们这里以hadoop-1.2.1.tar.gz为例,解压,把这个项目全部倒入到MyEclipse里

File-----import----

选择项目导入

第二步  我们要修改Hadoop根目录下的src/contrib/META-INFO/MANIFEST.MF,修改这个jar的classpath。

找到这个文件的Bundle-ClassPath这一行,然后,修改成

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

这些jar包都可以在hadoop文件里面搜索到

第三步:修改build.xml文件,修改的地方我用红色标记了,一个是myeclipse位置,另一个是hadoop版本,其它还是原封不动

<?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 default="deploy" name="eclipse-plugin">

<import file="../build-contrib.xml"/>

<property name="eclipse.home" location="D:/Program Files/MyEclipse"/>
  <property name="version" value="1.2.1"/>

<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>

<!-- Override classpath to include Eclipse SDK jars -->
  <path id="classpath">
    <pathelement location="${build.classes}"/>
    <pathelement location="${hadoop.root}/build/classes"/>
    <fileset dir="${hadoop.root}">
        <include name="**/*.jar" />
    </fileset>
    <path refid="eclipse-sdk-jars"/>
  </path>

<!-- Skip building if eclipse.home is unset. -->
  <target name="check-contrib" unless="eclipse.home">
    <property name="skip.contrib" value="yes"/>
    <echo message="eclipse.home unset: skipping eclipse plugin"/>
  </target>

<target name="compile" depends="init, ivy-retrieve-common" unless="skip.contrib">
    <echo message="contrib: ${name}"/>
    <javac
     encoding="${build.encoding}"
     srcdir="${src.dir}"
     includes="**/*.java"
     destdir="${build.classes}"
     debug="${javac.debug}"
     deprecation="${javac.deprecation}"
     includeantruntime="on">
     <classpath refid="classpath"/>
    </javac>
  </target>

<!-- 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-${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"/>
    <echo message="${build.dir}"/>
    <echo message="${root}"/>
    <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>

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

</project>

第四步:点击window----Show View-----other----Ant----ok

会出现一个图标,点击项目中的build.xml选择OK,就会自动打包,打完插件。会放到F:\hadoop-1.2.1\build\contrib\eclipse-plugin这个目录下面。

这个目录是原先下载hadoop原路径。

第四章.使用ant编译hadoop eclipse插件的更多相关文章

  1. Windows平台上使用ANT编译Hadoop Eclipse Plugin

    一.准备工作:   1.安装JDK 下载页面:http://www.oracle.com/technetwork/java/javase/downloads/index.html JDK6,JDK7都 ...

  2. 使用Ant编译Hadoop工程报错

    在win7用Ant编译hadoop工程的时候,遇到了一个报错,如下: org.eclipse.core.runtime.CoreException: D:\workspace\hadoop-1.1.2 ...

  3. hadoop eclipse插件生成

    hadoop eclipse插件生成 做了一年的hadoop开发.还没有自动生成过eclipse插件,一直都是在网上下载别人的用,今天有时间,就把这段遗憾补回来,自己生成一下,废话不说,開始了. 本文 ...

  4. Hadoop学习笔记—6.Hadoop Eclipse插件的使用

    开篇:Hadoop是一个强大的并行软件开发框架,它可以让任务在分布式集群上并行处理,从而提高执行效率.但是,它也有一些缺点,如编码.调试Hadoop程序的难度较大,这样的缺点直接导致开发人员入门门槛高 ...

  5. The command ("dfs.browser.action.delete") is undefined 解决Hadoop Eclipse插件报错

    Hadoop Eclipse插件 报错. 使用 hadoop-eclipse-kepler-plugin-2.2.0.jar 如下所示 Error Log 强迫症看了 受不了 The command ...

  6. 编译hadoop eclipse的插件(hadoop1.0)

    原创文章,转载请注明: 转载自工学1号馆 欢迎关注我的个人博客:www.wuyudong.com, 更多云计算与大数据的精彩文章 在hadoop-1.0中,不像0.20.2版本,有现成的eclipse ...

  7. 每天收获一点点------Hadoop Eclipse插件的使用

    本文所用软件版本:myeclipe2014    hadoop1.2.1 1.安装Hadoop开发插件 下载hadoop-eclipse-plugin-1.2.1.jar,拷贝到myeclipse根目 ...

  8. ANT编译Android Eclipse工程

    将Android SDK的tools/和platform-tools/目录包含在可执行文件的搜索路径中.Windows下,将其添加到PATH环境变量中 切换到Android Eclipse项目目录下, ...

  9. Hadoop Eclipse 插件制作以及安装

    在本地使用Eclipse调试MapReduce程序,需要Hadoop插件,笔摘记录下制作安装过程. 准备工作(hadoop-2.6.0为例): 搭建好Hadoop环境 下载Hadoop安装包,解压到某 ...

随机推荐

  1. 在CentOS7 安装ffmpeg

    参考自:https://linuxize.com/post/how-to-install-ffmpeg-on-centos-7/ 首先切换至root用户 yum install epel-releas ...

  2. vue.js 源代码学习笔记 ----- 工具方法 props

    /* @flow */ import { hasOwn, isObject, isPlainObject, capitalize, hyphenate } from 'shared/util' imp ...

  3. 对map参数进行排序

    /**     * Map转换成url参数 by csl     *     * @param map     * @param isSort 是否排序     * @return     */   ...

  4. 个人Blog小程序开发完毕

    今天忙了一天,算是把这个小程序弄好了,包括小程序前端页面.接口对接.后台系统.服务器架 设.域名备案.证书安装(现在阿里云的免费证书怎么审核要这么久啊,到现在还在审核中) 先上截图: 这个背景图片的替 ...

  5. PyQt: “AttributeError: 'Form' object has no attribute 'exec_'” when opening second window

    # -*- coding: utf-8 -*- import sys from PyQt5.QtWidgets import QApplication , QMainWindow from PyQt5 ...

  6. caffe 一些网络参数

    caffe一些网络参数的:http://www.docin.com/p-871820919.html

  7. iOS调用第三方API/Framework

    前言 老板不止一次地说过:这个世纪靠个人的能力去完成一件事情肯定是不够的.无论什么方面我们都可以找到许许多多的事例表明合作共赢的重要性,例如Linux的发展.建筑事务所的发展.乃至科学技术的发展等等. ...

  8. 通过反编译让SpecFlow支持多层属性值的验证

    需求:在使用SpecFlow时,我希望能对目标对象所关联的对象属性进行验证,但SpecFlow(Version 1.9.0)无法实现.如图中红框,可以对专户所属的金融机构的名称进行验证. 反编译步骤 ...

  9. try...except包含try...finally方法

    def f(): try: try: f = open(raw_input('>')) print f.readlines() finally: f.close() #1/0 except Ex ...

  10. BZOJ4150 AMPPZ2014 The Staging 【线段树】*

    BZOJ4150 AMPPZ2014 The Staging Description 在舞台上有n个枪手,第i个枪手瞄准了第p[i]个枪手,将于第u[i]秒开枪.一个枪手如果成功开枪, 那么被瞄准的枪 ...