`
Gauss.Deng
  • 浏览: 29490 次
  • 性别: Icon_minigender_1
  • 来自: 深圳
社区版块
存档分类
最新评论

使用Git下载Hadoop的到本地Eclipse开发环境

阅读更多
问题场景
按照官网http://wiki.apache.org/hadoop/EclipseEnvironment指导,要把Hadoop下载到本地,并构建Eclipse开发环境,只需要三条指令:
$ git clone git://git.apache.org/hadoop-common.git
$ mvn install -DskipTests
$ mvn eclipse:eclipse -DdownloadSources=true -DdownloadJavadocs=true

即可,但当我在本地执行完第二条后,报出如下错误日志信息:
[INFO] 
[INFO] --- maven-antrun-plugin:1.6:run (compile-proto) @ hadoop-common ---
[INFO] Executing tasks

main:
     [exec] target/compile-proto.sh: line 17: protoc: command not found
     [exec] target/compile-proto.sh: line 17: protoc: command not found
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO] 
[INFO] Apache Hadoop Main ................................ SUCCESS [2.389s]
[INFO] Apache Hadoop Project POM ......................... SUCCESS [0.698s]
[INFO] Apache Hadoop Annotations ......................... SUCCESS [1.761s]
[INFO] Apache Hadoop Project Dist POM .................... SUCCESS [0.729s]
[INFO] Apache Hadoop Assemblies .......................... SUCCESS [0.353s]
[INFO] Apache Hadoop Auth ................................ SUCCESS [1.998s]
[INFO] Apache Hadoop Auth Examples ....................... SUCCESS [1.227s]
[INFO] Apache Hadoop Common .............................. FAILURE [1.132s]
[INFO] Apache Hadoop Common Project ...................... SKIPPED
[INFO] Apache Hadoop HDFS ................................ SKIPPED
[INFO] Apache Hadoop HttpFS .............................. SKIPPED
[INFO] Apache Hadoop HDFS BookKeeper Journal ............. SKIPPED
[INFO] Apache Hadoop HDFS Project ........................ SKIPPED
[INFO] hadoop-yarn ....................................... SKIPPED
[INFO] hadoop-yarn-api ................................... SKIPPED
[INFO] hadoop-yarn-common ................................ SKIPPED
[INFO] hadoop-yarn-server ................................ SKIPPED
[INFO] hadoop-yarn-server-common ......................... SKIPPED
[INFO] hadoop-yarn-server-nodemanager .................... SKIPPED
[INFO] hadoop-yarn-server-web-proxy ...................... SKIPPED
[INFO] hadoop-yarn-server-resourcemanager ................ SKIPPED
[INFO] hadoop-yarn-server-tests .......................... SKIPPED
[INFO] hadoop-mapreduce-client ........................... SKIPPED
[INFO] hadoop-mapreduce-client-core ...................... SKIPPED
[INFO] hadoop-yarn-applications .......................... SKIPPED
[INFO] hadoop-yarn-applications-distributedshell ......... SKIPPED
[INFO] hadoop-yarn-site .................................. SKIPPED
[INFO] hadoop-mapreduce-client-common .................... SKIPPED
[INFO] hadoop-mapreduce-client-shuffle ................... SKIPPED
[INFO] hadoop-mapreduce-client-app ....................... SKIPPED
[INFO] hadoop-mapreduce-client-hs ........................ SKIPPED
[INFO] hadoop-mapreduce-client-jobclient ................. SKIPPED
[INFO] Apache Hadoop MapReduce Examples .................. SKIPPED
[INFO] hadoop-mapreduce .................................. SKIPPED
[INFO] Apache Hadoop MapReduce Streaming ................. SKIPPED
[INFO] Apache Hadoop Distributed Copy .................... SKIPPED
[INFO] Apache Hadoop Archives ............................ SKIPPED
[INFO] Apache Hadoop Rumen ............................... SKIPPED
[INFO] Apache Hadoop Extras .............................. SKIPPED
[INFO] Apache Hadoop Tools Dist .......................... SKIPPED
[INFO] Apache Hadoop Tools ............................... SKIPPED
[INFO] Apache Hadoop Distribution ........................ SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 12.483s
[INFO] Finished at: Mon Jan 30 22:57:23 GMT+08:00 2012
[INFO] Final Memory: 24M/81M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-antrun-plugin:1.6:run (compile-proto) on project hadoop-common: An Ant BuildException has occured: exec returned: 127 -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
[ERROR] 
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR]   mvn <goals> -rf :hadoop-common


此问题我暂时还未分析具体原因和解决方案,暂时记录下。
展开分析
通过再此使用命令打出错误信息:
$ mvn install -DskipTests -e

得到详细错误信息为:
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 9.387s
[INFO] Finished at: Mon Jan 30 23:11:07 GMT+08:00 2012
[INFO] Final Memory: 19M/81M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-antrun-plugin:1.6:run (compile-proto) on project hadoop-common: An Ant BuildException has occured: exec returned: 127 -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-antrun-plugin:1.6:run (compile-proto) on project hadoop-common: An Ant BuildException has occured: exec returned: 127
	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:217)
	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
	at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
	at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
	at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
	at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
	at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:319)
	at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
	at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537)
	at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
	at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:597)
	at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290)
	at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)
	at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)
	at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)
Caused by: org.apache.maven.plugin.MojoExecutionException: An Ant BuildException has occured: exec returned: 127
	at org.apache.maven.plugin.antrun.AntRunMojo.execute(AntRunMojo.java:283)
	at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101)
	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
	... 19 more
Caused by: /Users/apple/Documents/Hadoop-common-dev/hadoop-common/hadoop-common-project/hadoop-common/target/antrun/build-main.xml:23: exec returned: 127
	at org.apache.tools.ant.taskdefs.ExecTask.runExecute(ExecTask.java:650)
	at org.apache.tools.ant.taskdefs.ExecTask.runExec(ExecTask.java:676)
	at org.apache.tools.ant.taskdefs.ExecTask.execute(ExecTask.java:502)
	at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)
	at sun.reflect.GeneratedMethodAccessor16.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:597)
	at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
	at org.apache.tools.ant.Task.perform(Task.java:348)
	at org.apache.tools.ant.Target.execute(Target.java:390)
	at org.apache.tools.ant.Target.performTasks(Target.java:411)
	at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1397)
	at org.apache.tools.ant.Project.executeTarget(Project.java:1366)
	at org.apache.maven.plugin.antrun.AntRunMojo.execute(AntRunMojo.java:270)
	... 21 more
[ERROR] 
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
[ERROR] 

通过上面错误信息,真方便找到解决方案。

根据上面的提示,访问https://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
得到如下提示信息:
        Unlike many other errors, this exception is not generated by the Maven core itself but by a plugin. As a rule of thumb, plugins use this error to signal a problem in their configuration or the information they retrieved from the POM.
        这里说的意思是:
        这个错误不是Maven本身的错误,根据经验,可能是Maven使用的插件通过这个异常来标识它们没有从POM中获得相关的配置信息。

接下来进一步分析,通过Maven构建Hadoop过程中是否使用了插件。
        从错误日志分析,编译过程使用了插件:maven-antrun-plugin。由于编译Hadoop-common过程中出错,所以进一步定位到hadoop-common工程下的POM.xml,可到看到下面信息:
<plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-antrun-plugin</artifactId>
        <executions>
          <execution>
            <id>compile-proto</id>
            <phase>generate-sources</phase>
            <goals>
              <goal>run</goal>
            </goals>
            <configuration>
              <target>
                <echo file="target/compile-proto.sh">
                    PROTO_DIR=src/main/proto
                    JAVA_DIR=target/generated-sources/java
                    which cygpath 2> /dev/null
                    if [ $? = 1 ]; then
                      IS_WIN=false
                    else
                      IS_WIN=true
                      WIN_PROTO_DIR=`cygpath --windows $PROTO_DIR`
                      WIN_JAVA_DIR=`cygpath --windows $JAVA_DIR`
                    fi
                    mkdir -p $JAVA_DIR 2> /dev/null
                    for PROTO_FILE in `ls $PROTO_DIR/*.proto 2> /dev/null`
                    do
                        if [ "$IS_WIN" = "true" ]; then
                          protoc -I$WIN_PROTO_DIR --java_out=$WIN_JAVA_DIR $PROTO_FILE
                        else
                          protoc -I$PROTO_DIR --java_out=$JAVA_DIR $PROTO_FILE
                        fi
                    done
                </echo>
                <exec executable="sh" dir="${basedir}" failonerror="true">
                  <arg line="target/compile-proto.sh"/>
                </exec>
              </target>
            </configuration>
          </execution>
          <execution>
            <id>compile-test-proto</id>
            <phase>generate-test-sources</phase>
            <goals>
              <goal>run</goal>
            </goals>
            <configuration>
              <target>
                <echo file="target/compile-test-proto.sh">
                    PROTO_DIR=src/test/proto
                    JAVA_DIR=target/generated-test-sources/java
                    which cygpath 2> /dev/null
                    if [ $? = 1 ]; then
                      IS_WIN=false
                    else
                      IS_WIN=true
                      WIN_PROTO_DIR=`cygpath --windows $PROTO_DIR`
                      WIN_JAVA_DIR=`cygpath --windows $JAVA_DIR`
                    fi
                    mkdir -p $JAVA_DIR 2> /dev/null
                    for PROTO_FILE in `ls $PROTO_DIR/*.proto 2> /dev/null`
                    do
                        if [ "$IS_WIN" = "true" ]; then
                          protoc -I$WIN_PROTO_DIR --java_out=$WIN_JAVA_DIR $PROTO_FILE
                        else
                          protoc -I$PROTO_DIR --java_out=$JAVA_DIR $PROTO_FILE
                        fi
                    done
                </echo>
                <exec executable="sh" dir="${basedir}" failonerror="true">
                  <arg line="target/compile-test-proto.sh"/>
                </exec>
              </target>
            </configuration>
          </execution>
          <execution>
            <id>save-version</id>
            <phase>generate-sources</phase>
            <goals>
              <goal>run</goal>
            </goals>
            <configuration>
              <target>
                <mkdir dir="${project.build.directory}/generated-sources/java"/>
                <exec executable="sh">
                  <arg
                      line="${basedir}/dev-support/saveVersion.sh ${project.version} ${project.build.directory}/generated-sources/java"/>
                </exec>
              </target>
            </configuration>
          </execution>
          <execution>
            <id>generate-test-sources</id>
            <phase>generate-test-sources</phase>
            <goals>
              <goal>run</goal>
            </goals>
            <configuration>
              <target>

                <mkdir dir="${project.build.directory}/generated-test-sources/java"/>

                <taskdef name="recordcc" classname="org.apache.hadoop.record.compiler.ant.RccTask">
                  <classpath refid="maven.compile.classpath"/>
                </taskdef>
                <recordcc destdir="${project.build.directory}/generated-test-sources/java">
                  <fileset dir="${basedir}/src/test/ddl" includes="**/*.jr"/>
                </recordcc>
              </target>
            </configuration>
          </execution>
          <execution>
            <id>create-log-dir</id>
            <phase>process-test-resources</phase>
            <goals>
              <goal>run</goal>
            </goals>
            <configuration>
              <target>
                <!--
                TODO: there are tests (TestLocalFileSystem#testCopy) that fail if data
                TODO: from a previous run is present
                -->
                <delete dir="${test.build.data}"/>
                <mkdir dir="${test.build.data}"/>
                <mkdir dir="${hadoop.log.dir}"/>

                <copy toDir="${project.build.directory}/test-classes">
                  <fileset dir="${basedir}/src/main/conf"/>
                </copy>
              </target>
            </configuration>
          </execution>
          <execution>
            <phase>pre-site</phase>
            <goals>
              <goal>run</goal>
            </goals>
            <configuration>
              <tasks>
                <copy file="src/main/resources/core-default.xml" todir="src/site/resources"/>
                <copy file="src/main/xsl/configuration.xsl" todir="src/site/resources"/>
              </tasks>
            </configuration>
          </execution>
        </executions>
      </plugin>

上面是在Pom.xml文件中使用Maven下使用Ant插件,里面有一行:
<echo file="target/compile-proto.sh">

看着让人不解,联系到HowToContribueToHadoop的文章http://wiki.apache.org/hadoop/HowToContribute可以推知,有可能由于本地没有安装ProtocolBuffers引起的,因为文章内部特别说明了:
引用
Hadoop 0.23+ must have Google's ProtocolBuffers for compilation to work.
接下来打算在本地重新安装ProtocolBuffers后再编译部署。


如预期,在本地安装好了Protoc Buffer后,后面两条指令顺利执行完整,剩下的就依据官网把目录下的工程导入Eclipse后,就可以在Eclipse下学习调试源码。
分享到:
评论
2 楼 jnh 2014-03-27  
写的不错啊。
标题多了一个“的”。
官方文档:http://wiki.apache.org/hadoop/EclipseEnvironment
1 楼 camlelxy 2013-12-17  
按照lz的配置没有成功  按照文档

Setup
-----
Install protobuf 2.5.0 (Download from http://code.google.com/p/protobuf/downloads/list)
- install the protoc executable (configure, make, make install)
- install the maven artifact (cd java; mvn install)

然后

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib加上这个以后才编译成功
我在ubuntu下编译的开2个窗口就会有问题。安装proto以后到hadoop-common目录下编译必须在同一个session中

相关推荐

    基于springboot+Javaweb的二手图书交易系统源码数据库文档.zip

    基于springboot+Javaweb的二手图书交易系统源码数据库文档.zip

    Linux课程设计.doc

    Linux课程设计.doc

    课程考试的概要介绍与分析

    课程考试资源描述 本资源是为应对各类课程考试而精心准备的综合性学习包。它包含了多门学科的考试指南、历年真题、模拟试题以及详细的答案解析。这些资源旨在帮助学生系统复习课程内容,理解考试要点,提高解题技巧,从而在考试中取得优异成绩。 资源中不仅包含了基础的考试资料,还特别加入了考试技巧讲解和备考策略分析。学生可以通过这些资源了解不同题型的解题方法和思路,学会如何在有限的时间内高效答题。此外,还有针对弱项科目和难点的专项训练,帮助学生攻克学习瓶颈。 为了确保资源的时效性和准确性,我们会定期更新考试资料和模拟试题,及时反映最新的考试动态和趋势。同时,也提供了在线交流平台,方便学生之间互相讨论、分享学习心得。 项目源码示例(简化版,Python) 以下是一个简单的Python脚本示例,用于生成包含选择题和答案的模拟试题: python import random # 定义选择题题库 questions = [ {"question": "Python的创始人是谁?", "options": ["A. 林纳斯·托瓦兹", "B. 巴纳姆", "C. 比尔·盖茨", "D.

    基于Django的食堂点餐系统

    基于 MySQL+Django 实现校园食堂点餐系统。 主要环境: PowerDesigner MySQL Workbench 8.0 CE Python 3.8 Django 3.2.8 BootStrap 3.3.7 Django-simpleui

    基于SpringBoot的同城宠物照看系统源码数据库文档.zip

    基于SpringBoot的同城宠物照看系统源码数据库文档.zip

    value_at_a_point.ipynb

    GEE训练教程

    基于springboot+Web的心理健康交流系统源码数据库文档.zip

    基于springboot+Web的心理健康交流系统源码数据库文档.zip

    kotlin 实践微信插件助手, 目前支持抢红包(支持微信最新版本 7.0.0及7.0.3).zip

    微信小程序 kotlin 实践微信插件助手, 目前支持抢红包(支持微信最新版本 7.0.0及7.0.3).zip

    N32G45X运放电路检测电压

    N32G45X运放电路检测电压

    梦幻西游道人20241121数据

    梦幻西游道人是梦幻西游里面的一个NPC,主要是刷全服最实惠的高级兽决和其他很好用的比较贵的东西,在长安城、傲来国、长寿村中的任意一个场景出现,一般会出现30分钟,不过东西一般都被秒刷。 梦幻西游道人出现时间解析如下: 1.梦幻西游道人出现时间一直都保持着一年出现两次的规律,即2、3月份的元宵节期间来一次,9月份的教师节期间出现一次。 2.云游道人每个整点(0:00至7:00不出现)会在长安城、傲来国、长寿村中的任意一个场景出现,每次出现后停留时间为30分钟。

    tables-3.7.0-cp38-cp38-win_amd64.whl

    tables-3.7.0-cp38-cp38-win_amd64.whl

    基于springboot旧物回收管理系统源码数据库文档.zip

    基于springboot旧物回收管理系统源码数据库文档.zip

    MariaDB集群部署手册word版最新版本

    MariaDB数据库管理系统是MySQL的一个分支,主要由开源社区在维护,采用GPL授权许可 MariaDB的目的是完全兼容MySQL,包括API和命令行,使之能轻松成为MySQL的代替品。在存储引擎方面,使用XtraDB(英语:XtraDB)来代替MySQL的InnoDB。 本文档介绍了MariaDB 10.1的集群部署,至少三台机器做成集群,每台可以同时提供读和写,感兴趣的小伙伴们可以参考一下

    JavaScript语言教程:基础语法、DOM操作、事件处理及新特性详解

    内容概要:本文档全面介绍了JavaScript作为一种轻量级的、解释型的语言及其在前端开发中的广泛应用。从JavaScript的基本概念出发,详尽讲解了基础语法(如变量、数据类型、运算符、流程控制)、函数和闭包、对象和原型、DOM操作(如获取、修改、添加和删除元素)、事件处理(如事件监听器、事件对象)、AJAX与Fetch API、ES6+的新特性(如箭头函数、模板字符串、解构赋值)以及前端框架和库(React、Vue、Angular)。除此之外,文章还涉及了代码优化技巧(如减少DOM操作、选择适当的算法和数据结构、使用工具提升代码性能),并对JavaScript的应用场景和发展趋势进行了展望。 适用人群:适用于初学者或具有少量编程经验的学习者,旨在帮助他们系统掌握JavaScript基础知识和前沿技术。 使用场景及目标:通过本教程的学习,读者不仅可以学会基本语法,还能理解并掌握高级概念和技术,如DOM操纵、事件处理机制、异步编程及最新的ECMAScript规范。这不仅有助于改善用户体验、增强网站互动性和响应速度,也能有效提升自身的编码水平和项目开发能力。 其他说明:此文档不仅涵盖了JavaScript的传统功能,还有现代前端技术和最佳实践指导,确保读者能够紧跟行业发展步伐,成为合格甚至优秀的Web开发人员。

    毕业设计&课设_安卓公交线路查询 app(含架构技术、数据格式及数据库相关说明).zip

    该资源内项目源码是个人的课程设计、毕业设计,代码都测试ok,都是运行成功后才上传资源,答辩评审平均分达到96分,放心下载使用! ## 项目备注 1、该资源内项目代码都经过严格测试运行成功才上传的,请放心下载使用! 2、本项目适合计算机相关专业(如计科、人工智能、通信工程、自动化、电子信息等)的在校学生、老师或者企业员工下载学习,也适合小白学习进阶,当然也可作为毕设项目、课程设计、作业、项目初期立项演示等。 3、如果基础还行,也可在此代码基础上进行修改,以实现其他功能,也可用于毕设、课设、作业等。 下载后请首先打开README.md文件(如有),仅供学习参考, 切勿用于商业用途。

    基于springboot高考志愿智能推荐系统源码数据库文档.zip

    基于springboot高考志愿智能推荐系统源码数据库文档.zip

    经典-FPGA时序约束教程

    经典-FPGA时序约束教程

    mcu交互实验整体文件

    mcu交互实验整体文件

    Collins COBUILD (CN).mdx

    Collins COBUILD (CN).mdx

    自定义springboot starter,提供HelloService

    自定义springboot starter

Global site tag (gtag.js) - Google Analytics