工学1号馆

home

« | 返回首页 | »

编译hadoop2.6.0的eclipse插件

By Wu Yudong on May 21, 2015

原创文章,转载请注明: 转载自工学1号馆

本文链接地址: http://wuyudong.com/archives/14

1、安装git:

sudo apt-get install git

2、安装与配置ant:

可以使用

sudo apt-get install ant

安装,但是这种装法不好。首先安装的ant不是最新的版本,其次还要装一堆其他的附带的东西。所以选择自己手动ant安装。

安装步骤:

(1)到Apache官网下载最新版本的ant:http://ant.apache.org/bindownload.cgi

(2)解压下载下来的.tar.gz文件到指定文件夹opt下

(3)配置环境变量:sudo gedit /etc/profile,在原来基础上添加以下蓝体字:

export ANT_HOME=home/hadoop/opt/apache-ant-1.9.4
export PATH=$JAVA_HOME/bin:$PATH:$ANT_HOME/bin

(4)验证是否安装成功:

hadoop@ubuntu:~$ ant -version

Apache Ant(TM) version 1.9.4 compiled on April 29 2014

表示安装成功!

3、接着下载源码:

git clone https://github.com/winghc/hadoop2x-eclipse-plugin.git

4、编译Hadoop2.6.0的eclipse插件

(1)Hadoop2xeclipse插件源码在github上,地址为:https://github.com/winghc/hadoop2x-eclipse-plugin

(2)下载下来后,解压缩到某个目录下,比如/home/hadoop/hadoop2x-eclipse-plugin目录

(3)cd到/home/hadoop/hadoop2x-eclipse-plugin/src/constrib/eclipse-plugin目录下,修改build.xml文件:

<target name="compile" depends="init, ivy-retrieve-common" unless="skip.contrib">

将红色部分去掉,免得编译时ivy-common过不去

(4)运行命令:

ant jar -Dversion=2.4.1 -Dhadoop.version=2.6.0 -Declipse.home=/home/hadoop/opt/eclipse -Dhadoop.home=/home/hadoop/opt/hadoop-2.6.0

………………

[copy] Copying 1 file to /home/hadoop/hadoop2x-eclipse-plugin/build/contrib/eclipse-plugin/lib
[copy] Copying /home/hadoop/opt/hadoop-2.6.0/share/hadoop/common/lib/netty-3.6.2.Final.jar to /home/hadoop/hadoop2x-eclipse-plugin/build/contrib/eclipse-plugin/lib/netty-3.6.2.Final.jar
[copy] Copying 1 file to /home/hadoop/hadoop2x-eclipse-plugin/build/contrib/eclipse-plugin/lib
[copy] Copying /home/hadoop/opt/hadoop-2.6.0/share/hadoop/common/lib/htrace-core-3.0.4.jar to /home/hadoop/hadoop2x-eclipse-plugin/build/contrib/eclipse-plugin/lib/htrace-core-3.0.4.jar
[jar] Building jar: /home/hadoop/hadoop2x-eclipse-plugin/build/contrib/eclipse-plugin/hadoop-eclipse-plugin-2.6.0.jar

BUILD SUCCESSFUL
Total time: 21 seconds

hadoop的版本和位置,eclipse的位置,都按照自己的实际情况进行填写。

编译完成后,就会在/home/hadoop2x-eclipse-plugin/build/contrib/eclipse-plugin/下生成hadoop-eclipse-plugin-2.6.0.jar

如果文章对您有帮助,欢迎点击下方按钮打赏作者

Comments

No comments yet.
To verify that you are human, please fill in "七"(required)