编译打包eclipse hadoop plugin
在hadoop最新的版本1.0.1中并没有附带hadoop的eclipse插件,因此需要我们自己编译打出一个hadoop-eclipse-plugin-1.0.1.jar插件
在hadoop-1.0.1\src\contrib下有个eclipse-plugin的文件夹存放了插件的源代码,打包时需要使用ant,请预先安装ant,由于仅仅是打包eclipse-plugin,而buidl.xml中需要整个hadoop都打包编译的基础上进行操作,因此我们需要修改一些文件。
首先,在hadoop-1.0.1\src\contrib下的build-contrib.xml中添加eclipse.home
<property name="eclipse.home" location="E:/MyHadoopWorkspace/eclipse" />
其次修改eclipse-plugin下的build.xml文件,在classpath中添加hadoop-core和common lib的依赖
<path id="classpath"> <pathelement location="${build.classes}"/> <pathelement location="${hadoop.root}/build/classes"/> <!-- hadoop-core-1.0.1.jar dependency --> <pathelement location="${hadoop.root}"/> <!-- common lib dependency --> <pathelement location="${hadoop.root}/lib"/> <path refid="eclipse-sdk-jars"/> </path>
其此修改打进的jar包和打出的版本名称,按一下修改
<target name="jar" depends="compile" unless="skip.contrib"> <mkdir dir="${build.dir}/lib"/> <!-- 将以下jar包打进hadoop-eclipse-1.0.1.jar中 --> <copy file="${hadoop.root}/hadoop-core-1.0.1.jar" tofile="${build.dir}/lib/hadoop-core.jar" verbose="true"/> <copy file="${hadoop.root}/lib/commons-cli-1.2.jar" todir="${build.dir}/lib" verbose="true"/> <copy file="${hadoop.root}/lib/commons-lang-2.4.jar" todir="${build.dir}/lib" verbose="true"/> <copy file="${hadoop.root}/lib/commons-configuration-1.6.jar" todir="${build.dir}/lib" verbose="true"/> <copy file="${hadoop.root}/lib/jackson-mapper-asl-1.8.8.jar" todir="${build.dir}/lib" verbose="true"/> <copy file="${hadoop.root}/lib/jackson-core-asl-1.8.8.jar" todir="${build.dir}/lib" verbose="true"/> <copy file="${hadoop.root}/lib/commons-httpclient-3.0.1.jar" todir="${build.dir}/lib" verbose="true"/> <jar jarfile="${build.dir}/hadoop-${name}-1.0.1.jar" manifest="${root}/META-INF/MANIFEST.MF"> <fileset dir="${build.dir}" includes="classes/ lib/"/> <fileset dir="${root}" includes="resources/ plugin.xml"/> </jar> </target>
最后执行命令ant jar就可以打出hadoop-eclipse-plugin-1.0.1.jar,打出的jar包放在hadoop-1.0.1\build\contrib\eclipse-plugin下,将其复制到eclipse目录下的plugins下,然后重启。打出的插件在eclipse Helios SR1下是可用的,可以在window -> show view -> MapReduce Tools视图下看到并进行配置。
相关推荐
changjiang 2020-11-16
minerd 2020-10-28
WeiHHH 2020-09-23
Aleks 2020-08-19
WeiHHH 2020-08-17
飞鸿踏雪0 2020-07-26
tomli 2020-07-26
deyu 2020-07-21
strongyoung 2020-07-19
eternityzzy 2020-07-19
Elmo 2020-07-19
飞鸿踏雪0 2020-07-09
飞鸿踏雪0 2020-07-04
xieting 2020-07-04
WeiHHH 2020-06-28
genshengxiao 2020-06-26
Hhanwen 2020-06-25