一 概述
通过ANT生成hadoop指定版本的eclipse插件。
PS:这里我们是针对hadoop-2.7.1
二 环境
- hadoop-2.7.1
- win10 x64
- oracle java 1.7.0_79
- ANT 1.9.6
- hadoop2x-eclipse-plugin-master.zip
- eclipse
三 开始定制插件
3-1 下载插件源码
下载地址:https://github.com/winghc/hadoop2x-eclipse-plugin
准备好编译完成的hadoop:这里我之前已经编译好了所以省略该内容
F:\>cd hadoop2x-eclipse-plugin-master
F:\hadoop2x-eclipse-plugin-master>dir
驱动器 F 中的卷没有标签。
卷的序列号是 D874-40DC
F:\hadoop2x-eclipse-plugin-master 的目录
2015/12/29 00:40 <DIR> .
2015/12/29 00:40 <DIR> ..
2015/12/29 00:40 <DIR> build
2014/12/13 22:58 <DIR> ivy
2014/12/13 22:58 10,525 ivy.xml
2014/12/13 22:58 1,472 README.md
2014/12/13 22:58 <DIR> release
2014/12/13 22:58 <DIR> src
2 个文件 11,997 字节
6 个目录 240,270,749,696 可用字节
F:\hadoop2x-eclipse-plugin-master>
3-2 查看相关环境变量
C:\Users\tang0>set ANT_HOME=F:\Program Files Development\apache-ant-1.9.6
C:\Users\tang0>set JAVA_HOME=C:\Program Files\Java\jdk1.7.0_79
C:\Users\tang0>set PATH=%ANT_HOME%\bin;%JAVA_HOME%\bin
C:\Users\tang0>ANT
Buildfile: build.xml does not exist!
Build failed
C:\Users\tang0>ant -version
Apache Ant(TM) version 1.9.6 compiled on June 29 2015
C:\Users\tang0>java -version
java version "1.7.0_79"
Java(TM) SE Runtime Environment (build 1.7.0_79-b15)
Java HotSpot(TM) 64-Bit Server VM (build 24.79-b02, mixed mode)
3-3 编译
执行如下命令:
F:\>cd hadoop2x-eclipse-plugin-master\src\contrib\eclipse-plugin
F:\hadoop2x-eclipse-plugin-master\src\contrib\eclipse-plugin>ant jar -Dversion=2.7.1 -Dhadoop.version=2.7.1 -Declipse.home="F:\Program Files Development\eclipse" -Dhadoop.home="F:\Program Files Development\hadoop-2.7.1"
注意
首先在ant命令中如果路径出现空额需要使用”“包裹起来其次在编译时候由于官网下载下来的libraries.properties是2.6.1的所以我们需要修改里面的jar和hadoop/share下面的jar版本一致否则会报错
${hadoop2x-eclipse-plugin-master}/ivy/libraries.properties