如何编译hadoop1.x的eclipse插件
如何编译hadoop1.x的eclipse插件
发布时间:2021-11-27 10:24:17 来源:高防服务器网 阅读:98 作者:小新 栏目:云计算
小编给大家分享一下如何编译hadoop1.x的eclipse插件,希望大家阅读完这篇文章之后都有所收获,下面让我们一起去探讨吧!
注意:以下操作基于Hadoop-1.2.1,Eclipse Luna,Win7 64位
1、将hadoop eclipse插件的工程导入Eclipse。插件源码目录如下:
D:Lablibhadoophadoop-1.2.1srccontribeclipse-plugin
2、配置工程依赖
3、准备ant的配置文件
D:Lablibhadoophadoop-1.2.1srccontribbuild-contrib.xml
将以上build-contrib.xml拷贝到项目目录中,并修改文件内容。具体如下:
<property name="name" value="${ant.project.name}"/> <property name="root" value="${basedir}"/> <property name="hadoop.root" location="D:/Lab/lib/hadoop/hadoop-1.2.1"/> <property name="eclipse.home" location="D:/Program Files/Eclipse/eclipse-jee-luna-R-win32-x86_64"/> <property name="version" value="1.2.1"/> <property name="build.contrib.dir" location="${root}/build/contrib"/> <property name="build.dir" location="${root}/build/contrib/${name}"/>
4、修改build.xml
<!-- 1.修改 build-contrib.xml的位置,去掉"../" --> <import file="build-contrib.xml" /> <!-- 2.添加如下,否则提示"软件包 org.apache.hadoop.fs 不存在" --> <path id="hadoop-jars"> <fileset dir="${hadoop.root}/"> <include name="hadoop-*.jar" /> </fileset> </path> <!-- Override classpath to include Eclipse SDK jars --> <path id="classpath"> <pathelement location="${build.classes}" /> <pathelement location="${hadoop.root}/build/classes" /> <path refid="eclipse-sdk-jars" /> <path refid="hadoop-jars" /><!--本行为添加内容--> </path> <!-- 3.修改并添加jar包,有些包已经有了,只添没有的 --> <!-- Override jar target to specify manifest --> <target name="jar" depends="compile" unless="skip.contrib"> <mkdir dir="${build.dir}/lib" /> <copy file="${hadoop.root}/hadoop-core-${version}.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/commons-httpclient-3.0.1.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" /> <jar jarfile="${build.dir}/hadoop-${name}-${version}.jar" manifest="${root}/META-INF/MANIFEST.MF"> <fileset dir="${build.dir}" includes="classes/ lib/" /> <fileset dir="${root}" includes="resources/ plugin.xml" /> </jar> </target>
5、修改MENIFEST.MF,在Bundule-ClassPath中增加一些依赖的jar。
Bundle-ClassPath: classes/, D:/Lab/lib/hadoop/hadoop-1.2.1/lib/hadoop-core-1.2.1.jar, D:/Lab/lib/hadoop/hadoop-1.2.1/lib/commons-cli-1.2.jar, D:/Lab/lib/hadoop/hadoop-1.2.1/lib/commons-configuration-1.6.jar, D:/Lab/lib/hadoop/hadoop-1.2.1/lib/commons-httpclient-3.0.1.jar, D:/Lab/lib/hadoop/hadoop-1.2.1/lib/commons-lang-2.4.jar, D:/Lab/lib/hadoop/hadoop-1.2.1/lib/jackson-core-asl-1.8.8.jar, D:/Lab/lib/hadoop/hadoop-1.2.1/lib/jackson-mapper-asl-1.8.8.jar
5、增加Ant Builder。
6、编译
在Project菜单中Build Project
7、运行结果
Buildfile: D:Labws-back-endMapReduceToolsbuild.xml check-contrib: init: [echo] contrib: eclipse-plugin [mkdir] Created dir: D:Labws-back-endMapReduceToolsbuildcontribeclipse-plugin [mkdir] Created dir: D:Labws-back-endMapReduceToolsbuildcontribeclipse-pluginclasses [mkdir] Created dir: D:Labws-back-endMapReduceToolsbuildcontribeclipse-plugintest [mkdir] Created dir: D:Labws-back-endMapReduceToolsbuildcontribeclipse-pluginsystem [mkdir] Created dir: D:Labws-back-endMapReduceToolsbuildcontribeclipse-pluginsystemclasses [mkdir] Created dir: D:Labws-back-endMapReduceToolsbuildcontribeclipse-pluginexamples [mkdir] Created dir: D:Labws-back-endMapReduceToolsbuildcontribeclipse-plugintestlogs 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: D:Lablibhadoophadoop-1.2.1ivyivy-2.1.0.jar [get] http://repo2.maven.org/maven2/org/apache/ivy/ivy/2.1.0/ivy-2.1.0.jar moved to http://120.195.54.5:801/videoplayer/ivy-2.1.0.jar?ich_u_r_i=ae068fe40ff82e58486dd0954048cc19&ich_s_t_a_r_t=0&ich_e_n_d=0&ich_k_e_y=1445088923750763152452&ich_t_y_p_e=1&ich_d_i_s_k_i_d=6&ich_u_n_i_t=1 [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 = D:Lablibhadoophadoop-1.2.1ivyivysettings.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 = D:Lablibhadoophadoop-1.2.1ivyivysettings.xml compile: [echo] contrib: eclipse-plugin [javac] D:Labws-back-endMapReduceToolsbuild.xml:65: warning: 'includeantruntime' was not set, defaulting to build.sysclasspath=last; set to false for repeatable builds [javac] Compiling 45 source files to D:Labws-back-endMapReduceToolsbuildcontribeclipse-pluginclasses [javac] 注: 某些输入文件使用或覆盖了已过时的 API。 [javac] 注: 有关详细信息, 请使用 -Xlint:deprecation 重新编译。 [javac] 注: 某些输入文件使用了未经检查或不安全的操作。 [javac] 注: 有关详细信息, 请使用 -Xlint:unchecked 重新编译。 jar: [mkdir] Created dir: D:Labws-back-endMapReduceToolsbuildcontribeclipse-pluginlib [copy] Copying 1 file to D:Labws-back-endMapReduceToolsbuildcontribeclipse-pluginlib [copy] Copying D:Lablibhadoophadoop-1.2.1hadoop-core-1.2.1.jar to D:Labws-back-endMapReduceToolsbuildcontribeclipse-pluginlibhadoop-core.jar [copy] Copying 1 file to D:Labws-back-endMapReduceToolsbuildcontribeclipse-pluginlib [copy] Copying D:Lablibhadoophadoop-1.2.1libcommons-cli-1.2.jar to D:Labws-back-endMapReduceToolsbuildcontribeclipse-pluginlibcommons-cli-1.2.jar [copy] Copying 1 file to D:Labws-back-endMapReduceToolsbuildcontribeclipse-pluginlib [copy] Copying D:Lablibhadoophadoop-1.2.1libcommons-lang-2.4.jar to D:Labws-back-endMapReduceToolsbuildcontribeclipse-pluginlibcommons-lang-2.4.jar [copy] Copying 1 file to D:Labws-back-endMapReduceToolsbuildcontribeclipse-pluginlib [copy] Copying D:Lablibhadoophadoop-1.2.1libcommons-configuration-1.6.jar to D:Labws-back-endMapReduceToolsbuildcontribeclipse-pluginlibcommons-configuration-1.6.jar [copy] Copying 1 file to D:Labws-back-endMapReduceToolsbuildcontribeclipse-pluginlib [copy] Copying D:Lablibhadoophadoop-1.2.1libcommons-httpclient-3.0.1.jar to D:Labws-back-endMapReduceToolsbuildcontribeclipse-pluginlibcommons-httpclient-3.0.1.jar [copy] Copying 1 file to D:Labws-back-endMapReduceToolsbuildcontribeclipse-pluginlib [copy] Copying D:Lablibhadoophadoop-1.2.1libjackson-mapper-asl-1.8.8.jar to D:Labws-back-endMapReduceToolsbuildcontribeclipse-pluginlibjackson-mapper-asl-1.8.8.jar [copy] Copying 1 file to D:Labws-back-endMapReduceToolsbuildcontribeclipse-pluginlib [copy] Copying D:Lablibhadoophadoop-1.2.1libjackson-core-asl-1.8.8.jar to D:Labws-back-endMapReduceToolsbuildcontribeclipse-pluginlibjackson-core-asl-1.8.8.jar [jar] Building jar: D:Labws-back-endMapReduceToolsbuildcontribeclipse-pluginhadoop-eclipse-plugin-1.2.1.jar BUILD SUCCESSFUL Total time: 6 seconds
看完了这篇文章,相信你对“如何编译hadoop1.x的eclipse插件”有了一定的了解,如果想了解更多相关知识,欢迎关注高防服务器网行业资讯频道,感谢各位的阅读!
[微信提示:高防服务器能助您降低 IT 成本,提升运维效率,使您更专注于核心业务创新。
[图文来源于网络,不代表本站立场,如有侵权,请联系高防服务器网删除]
[