ITPub博客

首页 > 大数据 > Hadoop > Linux下编译Hadoop Eclipse插件(转)

Linux下编译Hadoop Eclipse插件(转)

Hadoop 作者:tfyxl 时间:2013-11-15 20:44:54 0 删除 编辑

最远正在进修hadoop,首先第一步学着编译了下hadoop-eclipse插件,中心逢到了很多问题,但终究仍是措置了。现将编译进程纪录下来,便于后里应用。
      那边是基于hadoop-1.0.4和eclipse Indigo版本。
      那边以HADOOP_HOME来闪现您电脑上hadoop的安装目录。
    
1、编辑${HADOOP_HOME}/src/contrib/下的build-contrib.xml文件
增添{version}和{eclipse.home}属性:

name="hadoopbuildcontrib" xmlns:ivy="antlib:org.apache.ivy.ant">  

<!-- 那边界说了 version & eclipse.home -->  

name="version" value="1.0.4"/>  

name="eclipse.home" value="/home/chqz/systool/eclipse/eclipse"/>
 

name="name" value="${ant.project.name}"/>  

name="root" value="${basedir}"/>  

name="hadoop.root" location="${root}/../../../"/>
2、编辑${HADOOP_HOME}/src/contrib/eclipse-plugin/下的build.xml文件
(1) 增添hadoop-jars path,并同时插脚到classpath中:

<!-- 那边增添了 hadoop-jars -->
id="hadoop-jars">
dir="${hadoop.root}/">
name="hadoop-*.jar"/>



<!-- Override classpath to include Eclipse SDK jars -->
id="classpath">
location="${build.classes}"/>
location="${hadoop.root}/build/classes"/>
refid="eclipse-sdk-jars"/>

<!-- 将 hadoop-jars 增添到那边 -->
refid="hadoop-jars"/>


(2) 设置includeantruntime=on,防备compile时报warning:

name="compile" depends="init, ivy-retrieve-common" unless="skip.contrib">
message="contrib: ${name}"/>

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

<!-- 设置includeantruntime=on,防备compile报warning -->

  includeantruntime="on">
refid="classpath"/>


(3) 增添将要打包到plugin中的第三方包列表:

<!-- Override jar target to specify manifest -->
name="jar" depends="compile" unless="skip.contrib">
dir="${build.dir}/lib"/>

  <!-- 那边次要建改的是file中的值,留意路径必定要准确 -->
file="${hadoop.root}/hadoop-core-${version}.jar"

tofile="${build.dir}/lib/hadoop-core.jar" verbose="true"/>
file="${hadoop.root}/lib/commons-cli-1.2.jar"

todir="${build.dir}/lib" verbose="true"/>
file="${hadoop.root}/lib/commons-lang-2.4.jar"

todir="${build.dir}/lib" verbose="true"/>
file="${hadoop.root}/lib/commons-configuration-1.6.jar"

todir="${build.dir}/lib" verbose="true"/>
file="${hadoop.root}/lib/jackson-mapper-asl-1.8.8.jar"

todir="${build.dir}/lib" verbose="true"/>
file="${hadoop.root}/lib/jackson-core-asl-1.8.8.jar"

todir="${build.dir}/lib" verbose="true"/>
file="${hadoop.root}/lib/commons-httpclient-3.0.1.jar"

todir="${build.dir}/lib" verbose="true"/>


jarfile="${build.dir}/hadoop-${name}-${version}.jar"
manifest="${root}/META-INF/MANIFEST.MF">
dir="${build.dir}" includes="classes/ lib/"/>
dir="${root}" includes="resources/ plugin.xml"/>


3、实施ant命令以天生hadoop-eclipse-plugin-${version}.jar包:
   进进到${HADOOP_HOME}/src/contrib/eclipse-plugin/目录下,
   然后实施ant命令,输出后果以下:
[chqz@chqz eclipse-plugin]$ ant
Buildfile: /home/chqz/plugin/hadoop/hadoop-1.0.4/src/contrib/eclipse-plugin/build.xml

check-contrib:

init:
[echo] contrib: eclipse-plugin

init-contrib:

ivy-download:
[get] Getting: http://repo2.maven.org/maven2/org/apache/ivy/ivy/2.1.0/ivy-2.1.0.jar
[get] To: /home/chqz/plugin/hadoop/hadoop-1.0.4/ivy/ivy-2.1.0.jar
[get] Not modified - so not downloaded

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 = /home/chqz/plugin/hadoop/hadoop-1.0.4/ivy/ivysettings.xml

ivy-resolve-common:
[ivy:resolve] :: resolving dependencies :: org.apache.hadoop#eclipse-plugin;working@chqz
[ivy:resolve] confs: [common]
[ivy:resolve] found commons-logging#commons-logging;1.0.4 in maven2
[ivy:resolve] found log4j#log4j;1.2.15 in maven2
[ivy:resolve] :: resolution report :: resolve 152ms :: artifacts dl 4ms
---------------------------------------------------------------------
| | modules || artifacts |
| conf | number| search|dwnlded|evicted|| number|dwnlded|
---------------------------------------------------------------------
| common | 2 | 0 | 0 | 0 || 2 | 0 |
---------------------------------------------------------------------

ivy-retrieve-common:
[ivy:retrieve] :: retrieving :: org.apache.hadoop#eclipse-plugin [sync]
[ivy:retrieve] confs: [common]
[ivy:retrieve] 0 artifacts copied, 2 already retrieved (0kB/8ms)
[ivy:cachepath] DEPRECATED: "ivy.conf.file" is deprecated, use "ivy.settings.file" instead
[ivy:cachepath] :: loading settings :: file = /home/chqz/plugin/hadoop/hadoop-1.0.4/ivy/ivysettings.xml

compile:
[echo] contrib: eclipse-plugin

jar:

BUILD SUCCESSFUL
Total time: 2 seconds
最后成功天生的hadoop-eclipse-plugin-${version}.jar正在${HADOOP_HOME}/build/contrib/eclipse-plugin下。

最近发现个可以看岛国爱情动作片的地方www.daoguo.org,种子很齐全哦,大家有空可以去看看哦。
<!-- 正文结束 -->

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/159263/viewspace-1119703/,如需转载,请注明出处,否则将追究法律责任。

上一篇: 没有了~
下一篇: 没有了~
请登录后发表评论 登录
全部评论