Flume-0.9.4源码编译及一些编译出错解决方法

 由于需要在Flume里面加入一些我需要的代码,这时候就需要重新编译Flume代码,因为在编译Flume源码的时候出现了很多问题,所以写出这篇博客,以此分享给那些也需要编译代码的人一些参考,这里以如何编译Flume-0.9.4源码为例进行说明。
  首先下载Flume0.9.4源码(可以到https://repository.cloudera.com/content/repositories/releases/com/cloudera/flume-distribution/0.9.4-cdh4.0.0/里面下载)之后,解压及编译:

1

[wyp@master Desktop]$ unzip flume-distribution-0.9.4-cdh4.0.0-project.zip

2

[wyp@master Desktop]$ cd flume-0.9.4-cdh4.0.0/

3

[wyp@master flume-0.9.4-cdh4.0.0]$  mvn package -Pdist -DskipTests -Dtar

这时候会出现下面的错误:

01

[INFO] ------------------------------------------------------------------------

 

02

[INFO] Reactor Summary:

03

[INFO]

 

04

[INFO] Flume ............................................. SUCCESS [0.003s]

05

[INFO] Flume Core ........................................ FAILURE [5.016s]

 

06

[INFO] Flume Master Config Web Application ............... SKIPPED

07

[INFO] Flume Node Web .................................... SKIPPED

 

08

[INFO] Flume Distribution Project ........................ SKIPPED

09

[INFO] A log4j appender for Flume ........................ SKIPPED

 

10

[INFO] Flume Hello World Plugin .......................... SKIPPED

11

[INFO] Flume HBase Plugin ................................ SKIPPED

 

12

[INFO] ------------------------------------------------------------------------

13

[INFO] BUILD FAILURE

 

14

[INFO] ------------------------------------------------------------------------

15

[INFO] Total time: 5.798s

 

16

[INFO] Finished at: Wed Jan 22 16:35:13 CST 2014

17

[INFO] Final Memory: 15M/136M

 

18

[INFO] ------------------------------------------------------------------------

19

[WARNING] The requested profile "dist" could not be activated because it does

 

20

not exist.

21

[ERROR] Failed to execute goal org.apache.thrift.tools:maven-thrift-plugin:

 

22

0.1.10:compile (default) on project flume-core: thrift did not exit cleanly.

23

Review output for more information. -> [Help 1]

 

24

[ERROR]

25

[ERROR] To see the full stack trace of the errors, re-run Maven with the

 

26

-e switch.

27

[ERROR] Re-run Maven using the -X switch to enable full debug logging.

 

28

[ERROR]

29

[ERROR] For more information about the errors and possible solutions,

 

30

please read the following articles:

31

[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/

 

32

                 MojoFailureException

33

[ERROR]

 

34

[ERROR] After correcting the problems, you can resume the build with

35

the command

 

36

[ERROR]   mvn <goals> -rf :flume-core

这是因为编译Flume的时候需要用到thrift插件,可以参考flume-core/pom.xml文件里面的配置:

01

<plugin>

 

02

    <groupId>org.apache.thrift.tools</groupId>

03

    <artifactId>maven-thrift-plugin</artifactId>

 

04

    <version>0.1.10</version>

05

    <configuration>

 

06

      <thriftExecutable>${thrift.executable}</thriftExecutable>

07

    </configuration>

 

08

    <executions>

09

      <execution>

 

10

        <goals>

11

          <goal>compile</goal>

 

12

          <goal>testCompile</goal>

13

        </goals>

 

14

      </execution>

15

    </executions>

 

16

</plugin>

  所以需要安装thrift,可以参考这里进行安装:《Flume-0.9.4源码编译依赖的thrift插件安装》安装完thrift,再环境变量里面设置一下THRIFT_HOME=/usr/local,因为在flume-core/pom.xml里面会用到thrift,如下:

01

<properties>

 

02

  <!-- NB: The version of the thrift compiler must match that of the dependency

03

  on the jar file below. -->

 

04

  <thrift.executable>${env.THRIFT_HOME}/bin/thrift</thrift.executable>

05

 

06

  <!-- Set default encoding to UTF-8 to remove maven complaints -->

07

  <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

 

08

09

  <!-- defaults for flaky test and focused test exclusions -->

 

10

  <test.exclude.pattern>$</test.exclude.pattern> <!-- junk pattern -->

11

  <test.include.pattern>**/Test*.java</test.include.pattern>

 

12

</properties>

接着再重新编译Flume源码,这时候将会出现大量类似以下的错误信息:

01

[WARNING] The requested profile "dist" could not be activated because it does

 

02

not exist.

03

[ERROR] Failed to execute goal org.apache.maven.plugins:

 

04

maven-compiler-plugin:2.3.2:compile (default-compile) on project flume-core:

05

Compilation failure: Compilation failure:

 

06

[ERROR] /home/wyp/Desktop/flume-src/flume-core/target/generated-sources/

07

thrift/com/cloudera/flume/conf/thrift/ThriftFlumeClientServer.java:[9,39]

 

08

错误: 程序包org.apache.commons.lang3.builder不存在

09

[ERROR] /home/wyp/Desktop/flume-src/flume-core/target/generated-sources/

 

10

thrift/com/cloudera/flume/conf/thrift/ThriftFlumeClientServer.java:[10,31]

11

错误: 程序包org.apache.thrift.scheme不存在

 

12

[ERROR] /home/wyp/Desktop/flume-src/flume-core/target/generated-sources/

13

thrift/com/cloudera/flume/conf/thrift/ThriftFlumeClientServer.java:[11,31]

 

14

错误: 程序包org.apache.thrift.scheme不存在

15

#########################################################################

 

16

                   下面省略了很多类似的错误信息

17

#########################################################################

请将pom.xml里面libthrift依赖版本修改为0.9.1,如下:

01

<dependency>

 

02

        <groupid>org.apache.thrift</groupid>

03

        <artifactid>libthrift</artifactid>

 

04

        <version>0.6.0-cdh</version>

05

</dependency>

 

06

07

改为

 

08

09

<dependency>

 

10

        <groupid>org.apache.thrift</groupid>

11

        <artifactid>libthrift</artifactid>

 

12

        <version>0.9.1</version>

13

</dependency>

修改完后再编译。紧接着的错误是类似下面的错误信息:

01

[WARNING] The requested profile "dist" could not be activated because it does

 

02

not exist.

03

[ERROR] Failed to execute goal on project flume-config-web: Could not resolve

 

04

dependencies for project com.cloudera:flume-config-web:war:0.9.4-cdh4.0.0:

05

Failure to find org.apache.hadoop:hadoop-core:jar:0.20.2-cdh3u3-SNAPSHOT in

 

06

https://repository.cloudera.com/content/groups/public/ was cached in the local

07

repository, resolution will not be reattempted until the update interval of

 

08

com.cloudera.repository.releases has elapsed or updates are forced -> [Help 1]

09

[ERROR]

 

10

[ERROR] To see the full stack trace of the errors,re-run Maven with the -e switch.

11

[ERROR] Re-run Maven using the -X switch to enable full debug logging.

 

12

[ERROR]

13

[ERROR] For more information about the errors and possible solutions, please read

 

14

the following articles:

15

[ERROR] [Help 1]

 

16

17

http://cwiki.apache.org/confluence/display/MAVEN/DependencyResolutionException

 

18

19

[ERROR]

 

20

[ERROR] After correcting the problems, you can resume the build with the command

21

[ERROR]   mvn <goals> -rf :flume-config-web

从错误信息可以得到编译Flume的时候依赖的hadoop-core:jar:0.20.2-cdh3u3-SNAPSHOT不能成功下载,解决办法是到pom.xml里面进行如下修改

01

<dependency>

 

02

        <groupId>org.apache.hadoop</groupId>

03

        <artifactId>hadoop-core</artifactId>

 

04

        <version>0.20.2-cdh3u3-SNAPSHOT</version>

05

        <exclusions>

 

06

          <exclusion>

07

            <groupId>com.cloudera.cdh</groupId>

 

08

            <artifactId>hadoop-ant</artifactId>

09

          </exclusion>

 

10

        </exclusions>

11

</dependency>

 

12

13

改为

 

14

15

<dependency>

 

16

        <groupId>org.apache.hadoop</groupId>

17

        <artifactId>hadoop-core</artifactId>

 

18

        <version>0.20.2-cdh3u3</version>

19

        <exclusions>

 

20

          <exclusion>

21

            <groupId>com.cloudera.cdh</groupId>

 

22

            <artifactId>hadoop-ant</artifactId>

23

          </exclusion>

 

24

        </exclusions>

25

</dependency>

修改完保存再编译源码。这时候应该可以顺利的进行编译,最后编译成功的界面如下:

01

[INFO] ------------------------------------------------------------------------

 

02

[INFO] Reactor Summary:

03

[INFO]

 

04

[INFO] Flume ............................................. SUCCESS [0.003s]

05

[INFO] Flume Core ........................................ SUCCESS [12.344s]

 

06

[INFO] Flume Master Config Web Application ............... SUCCESS [3.243s]

07

[INFO] Flume Node Web .................................... SUCCESS [0.885s]

 

08

[INFO] Flume Distribution Project ........................ SUCCESS [25.381s]

09

[INFO] A log4j appender for Flume ........................ SUCCESS [0.251s]

 

10

[INFO] Flume Hello World Plugin .......................... SUCCESS [0.133s]

11

[INFO] Flume HBase Plugin ................................ SUCCESS [20:42.199s]

 

12

[INFO] ------------------------------------------------------------------------

13

[INFO] BUILD SUCCESS

 

14

[INFO] ------------------------------------------------------------------------

15

[INFO] Total time: 21:25.138s

 

16

[INFO] Finished at: Thu Jan 23 00:50:28 CST 2014

17

[INFO] Final Memory: 42M/286M

 

18

[INFO] ------------------------------------------------------------------------

19

[WARNING] The requested profile "dist" could not be activated because it does

 

20

not exist.

21

[wyp@master flume-0.9.4-cdh4.0.0]$

恭喜你,编译成功了!

云帆教育大数据学院www.cloudyhadoop.com详情请加入QQ群:374152400 ,咨询课程顾问!

关注云帆教育微信公众号yfteach,第一时间获取公开课信息。

云帆教育大数据分享-Flume-0.9.4源码编译及一些编译出错解决方法相关推荐

  1. “卜算子·大数据”学习系列原创文章、源码——从入门到精通

    大数据 big-data :white_check_mark: 转载请注明出处与作者信息(如下) 原创作者:王小雷 作品出自:https://github.com/wangxiaoleiAI/big- ...

  2. 大数据 (三) BI报表系统 superset 源码搭建开发环境

    公司要用BI报表给业务来分析查询数据,对比了几个BI报表,不是收费,就是一般 最后决定用superset BI报表,开始去git上找源码开始搭建环境了. 我们是5月中下旬开始下的,当时superset ...

  3. 阿里年薪80W+大数据开发技能全套教程(源码+视频)都在这儿!

    随着大数据.云计算.物联网.人工智能这些行业的发展崛起,对于大数据人才的需求越来越大,而大数据人才的培养发展周期相对较长,导致了大数据人才短缺,市场供不应求.所以也就出现了大数据开发工程师.数仓工程师 ...

  4. 基于大数据重庆市气象数据分析 计算机毕设源码24928

    摘 要 信息化社会内需要与之针对性的信息获取途径,但是途径的扩展基本上为人们所努力的方向,由于站在的角度存在偏差,人们经常能够获得不同类型信息,这也是技术最为难以攻克的课题.针对气象数据等问题,对气象 ...

  5. 【首次免费】下载价值16880元转型人工智能、大数据开发全套教程(视频+源码)......

    如今随着环境的改变,物联网.AI.大数据.人工智能等,是未来的大趋势,而大数据是这些基石,万物互联,机器学习都是大数据应用场景! 为什么要学习大数据? 好比问一个程序员的人为什么要学编程! 大数据技术 ...

  6. javaweb基于JSP+Servlet开发大数据与应用专业企业门户网站源码 课程设计 大作业

    基于JSP+Servlet开发大数据与应用专业企业门户网站:(大作业/课程设计) 开发环境: Windows操作系统 开发工具: Eclipse+Jdk+Tomcat+MYSQL数据库 运行效果图: ...

  7. python数据分析与人工智能_正版 Python数据分析与可视化 微课视频版 魏伟一 李晓红 大数据与人工智能技术丛书 程序源码...

    第1章数据分析与可视化概述 1.1数据分析 1.2数据可视化 1.3数据分析与可视化常用工具 1.4为何选用Python进行数据分析与可视化 1.5Python数据分析与可视化常用类库 1.6Jupy ...

  8. 大数据之-Hadoop3.x_MapReduce_官方WordCount源码和序列化类型---大数据之hadoop3.x工作笔记0085

         这里的这个MrAppMaster跟我们,之前讲yarn的时候的那个ApplicationMaster的一个意思, 这个是个MrAppMster是个子类对吧. 这个我们可以理解为一个掌控全局的 ...

  9. 分享|教育信息化2.0:教育大数据解决方案(附PDF)

    核心摘要: 5G技术推动智能教育的发展,推进数字化转型,5G关键技术与其他新技术相结合,打造智能教育多个应用场景,服务教育信息化. 报告内容: ​ ​ 因公众号篇幅有限,本报告为精简版, 获取< ...

最新文章

  1. mysql锁表_MYSQL锁表问题的解决方法
  2. Blender与Substance painter制作三维手枪
  3. 树结构有什么好处_什么啊?面试官还在问HashMap了,老知识点了啊
  4. Gitlab 官方对整个数据删除事件的详细说明
  5. RSAC简介 RSAC 2020 最热门的36款网络安全产品
  6. Zabbix的邮件报警配置
  7. 增强学习(五)----- 时间差分学习(Q learning, Sarsa learning)
  8. Android App开发——添加APP启动界面
  9. php获取location,php获取header[‘location’]信息常见问题
  10. 【华为云技术分享】使用CloudIDE快速体验基于华为云ModelArts SDK的AI开发
  11. array 前端面试题_一则关于js数组的前端面试题
  12. 到底谁才是苹果公司实际控制人?
  13. Internet Explorer 无法打开搜索页
  14. Matlab | 画图线型及颜色符号汇总
  15. 在visio中让图片倾斜
  16. 硬件工程师成长之路(2)——电路设计
  17. 使用爱思助手备份苹果手机数据的方法
  18. 【安全资讯】2021年值得关注的10大网络安全工具
  19. 使用echarts生成漂亮的3D地图
  20. matlab中outputpath,关于handles.output_matlab gui参数传递

热门文章

  1. 免信任型计算的扩容模型
  2. 15-python推导式
  3. 戏说:诸葛亮的真实身份竟是汉献帝
  4. 微信输入法语音转文字的设计点
  5. 计算机视觉 专业术语,计算机视觉中常用的术语.doc
  6. mysql-8.0.31-winx64详细安装教程
  7. 【STM32Cube】学习笔记(二):超声波传感器
  8. 自带设备(BYOD)能用零信任框架吗?
  9. 华为、思科、爱立信、诺基亚、中兴等全球11大通讯设施企业2020年第三季度业绩...
  10. 计算机桌面图标乱码,教您软件乱码怎么修复