windows 中 hadoop2.7.5 在eclipse上的插件编译

1、下载插件源码

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

2、下载ant1.10.1

http://mirrors.tuna.tsinghua.edu.cn/apache//ant/binaries/apache-ant-1.10.1-bin.tar.gz

3、配置ant环境变量

ANT_HOME

E:\apache-ant-1.10.1-bin\apache-ant-1.10.1

path:增加%ANT_HOME%\bin

%JAVA_HOME%\bin;%M2_HOME%\bin;%ANT_HOME%\bin;----

4、下载hadoop-2.7.5和hadoop2x-eclipse-plugin插件,解压

5、配置编译插件

 进入到hadoop2x-eclipse-plugin-master\src\contrib\eclipse-plugin\build.xml文件中,找到

这一行

往下找

 

修改为

 

然后在此之后再增加以下两行


 

然后再找到

      jarfile="${build.dir}/hadoop-${name}-${hadoop.version}.jar"
      manifest="${root}/META-INF/MANIFEST.MF">

     
        value="classes/, ------------这一行


追加以下两行

 lib/servlet-api-${servlet-api.version}.jar,
 lib/commons-io-${commons-io.version}.jar,

并将lib/htrace-core-${htrace.version}.jar

替换为lib/htrace-core-${htrace.version}-incubating.jar

6、hadoop2x-eclipse-plugin-master\src\ivy\libraries.properties文件中,更改下列属性和其值使其对应hadoop2.7.5和当前环境的jar包版本,按以下配置文件中的版本好:
     hadoop.version=2.7.2       ------Hadoop版本号
     apacheant.version=1.10.1   -------ant版本号
     commons-collections.version=3.2.2
     commons-httpclient.version=3.1
     commons-logging.version=1.1.3
     commons-io.version=2.4
     slf4j-api.version=1.7.10
     slf4j-log4j12.version=1.7.10
7. hadoop2x-eclipse-plugin-master\ivy\libraries.properties文件中,属性和值的修改同上面的2.。另外需要增加一个修改:
     htrace.version=3.1.0

8、然后执行

ant jar -Dversion=2.7.5 -Declipse.home=D:\eclipseOXY\eclipse-jee-oxygen-R-win32-x86_64\eclipse -Dhadoop.home=E:\Hadoop\hadoop-2.7.5


-Declipse.home是eclipse路径

-Dhadoop.home是Hadoop所在路径

如果遇到ivy-resolve-common:位置会有短暂的停顿,等待即可。一般不会超过2分钟,如果时间太长,中断操作,然后检查配置文件是否出错

正常编译通过如下:

check-contrib:


init:
     [echo] contrib: eclipse-plugin


init-contrib:


ivy-probe-antlib:


ivy-init-antlib:


ivy-init:
[ivy:configure] :: Ivy 2.1.0 - 20090925235825 :: http://ant.apache.org/ivy/ ::
[ivy:configure] :: loading settings :: file = E:\Hadoop\hadoop2x-eclipse-plugin-master\ivy\ivysettings.xml


ivy-resolve-common:


ivy-retrieve-common:
[ivy:cachepath] DEPRECATED: 'ivy.conf.file' is deprecated, use 'ivy.settings.file' instead
[ivy:cachepath] :: loading settings :: file = E:\Hadoop\hadoop2x-eclipse-plugin-master\ivy\ivysettings.xml


compile:
     [echo] contrib: eclipse-plugin
   
[javac] E:\Hadoop\hadoop2x-eclipse-plugin-master\src\contrib\eclipse-plugin\build.xml:76: warning: 'includeantruntime' was not set, defaulting to build.sysclasspath=last; set to false for repeatable builds


jar:
     [copy] Copying 1 file to E:\Hadoop\hadoop2x-eclipse-plugin-master\build\contrib\eclipse-plugin\lib
     [copy] Copying E:\Hadoop\hadoop-2.7.5\share\hadoop\common\lib\slf4j-log4j12-1.7.10.jar to E:\Hadoop\hadoop2x-eclipse-plugin-master\build\contrib\eclipse-plugin\lib\slf4j-log4j12-1.7.10.jar
     [copy] Copying 1 file to E:\Hadoop\hadoop2x-eclipse-plugin-master\build\contrib\eclipse-plugin\lib
     [copy] Copying E:\Hadoop\hadoop-2.7.5\share\hadoop\common\lib\slf4j-api-1.7.10.jar to E:\Hadoop\hadoop2x-eclipse-plugin-master\build\contrib\eclipse-plugin\lib\slf4j-api-1.7.10.jar
     [copy] Copying 1 file to E:\Hadoop\hadoop2x-eclipse-plugin-master\build\contrib\eclipse-plugin\lib
     [copy] Copying E:\Hadoop\hadoop-2.7.5\share\hadoop\common\lib\guava-11.0.2.jar to E:\Hadoop\hadoop2x-eclipse-plugin-master\build\contrib\eclipse-plugin\lib\guava-11.0.2.jar
     [copy] Copying 1 file to E:\Hadoop\hadoop2x-eclipse-plugin-master\build\contrib\eclipse-plugin\lib
     [copy] Copying E:\Hadoop\hadoop-2.7.5\share\hadoop\common\lib\hadoop-auth-2.7.5.jar to E:\Hadoop\hadoop2x-eclipse-plugin-master\build\contrib\eclipse-plugin\lib\hadoop-auth-2.7.5.jar
     [copy] Copying 1 file to E:\Hadoop\hadoop2x-eclipse-plugin-master\build\contrib\eclipse-plugin\lib
     [copy] Copying E:\Hadoop\hadoop-2.7.5\share\hadoop\common\lib\netty-3.6.2.Final.jar to E:\Hadoop\hadoop2x-eclipse-plugin-master\build\contrib\eclipse-plugin\lib\netty-3.6.2.Final.jar
     [copy] Copying 1 file to E:\Hadoop\hadoop2x-eclipse-plugin-master\build\contrib\eclipse-plugin\lib
     [copy] Copying E:\Hadoop\hadoop-2.7.5\share\hadoop\common\lib\htrace-core-3.1.0-incubating.jar to E:\Hadoop\hadoop2x-eclipse-plugin-master\build\contrib\eclipse-plugin\lib\htrace-core-3.1.0-incubating.jar
     [copy] Copying 1 file to E:\Hadoop\hadoop2x-eclipse-plugin-master\build\contrib\eclipse-plugin\lib
     [copy] Copying E:\Hadoop\hadoop-2.7.5\share\hadoop\common\lib\servlet-api-2.5.jar to E:\Hadoop\hadoop2x-eclipse-plugin-master\build\contrib\eclipse-plugin\lib\servlet-api-2.5.jar
     [copy] Copying 1 file to E:\Hadoop\hadoop2x-eclipse-plugin-master\build\contrib\eclipse-plugin\lib
     [copy] Copying E:\Hadoop\hadoop-2.7.5\share\hadoop\common\lib\commons-io-2.4.jar to E:\Hadoop\hadoop2x-eclipse-plugin-master\build\contrib\eclipse-plugin\lib\commons-io-2.4.jar
      [jar] Building jar: E:\Hadoop\hadoop2x-eclipse-plugin-master\build\contrib\eclipse-plugin\hadoop-eclipse-plugin-2.7.5.jar


BUILD SUCCESSFUL
Total time: 31 seconds


会出现以下警告 [javac] E:\Hadoop\hadoop2x-eclipse-plugin-master\src\contrib\eclipse-plugin\build.xml:76: warning: 'includeantruntime' was not set, defaulting to build.sysclasspath=last; set to false for repeatable builds,上方的日志

解决方案:

       encoding="${build.encoding}"
     srcdir="${src.dir}"
     includes="**/*.java"
     destdir="${build.classes}"
     debug="${javac.debug}"
     deprecation="${javac.deprecation}"  
includeantruntime="on">  增加此字段即可,重新编译
     
   

解决       encoding="${build.encoding}"
     srcdir="${src.dir}"
     includes="**/*.java"
     destdir="${build.classes}"
     debug="${javac.debug}"
     deprecation="${javac.deprecation}"  
includeantruntime="on">
     
   






你可能感兴趣的:(Hadoop生态)