Eclipse查看flume源码

首先电脑要安装Maven

本文使用的是:apache-maven-3.0.5-bin.tar.gz

解压,配置环境变量。


Maven安装好后检查,出现下面信息表示安装Maven成功。


C:\Users\Administrator>mvn
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.080s
[INFO] Finished at: Thu Sep 29 11:44:05 CST 2016
[INFO] Final Memory: 4M/182M
[INFO] ------------------------------------------------------------------------
[ERROR] No goals have been specified for this build. You must specify a valid li
fecycle phase or a goal in the format <plugin-prefix>:<goal> or <plugin-group-id
>:<plugin-artifact-id>[:<plugin-version>]:<goal>. Available lifecycle phases are
: validate, initialize, generate-sources, process-sources, generate-resources, p
rocess-resources, compile, process-classes, generate-test-sources, process-test-
sources, generate-test-resources, process-test-resources, test-compile, process-
test-classes, test, prepare-package, package, pre-integration-test, integration-
test, post-integration-test, verify, install, deploy, pre-site, site, post-site,
 site-deploy, pre-clean, clean, post-clean. -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e swit
ch.
[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 rea
d the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/NoGoalSpecifie
dException



下载源码:

apache-flume-1.5.0-src.tar.gz


开始编译:

E:\software\apache-flume-1.5.0-src>mvn install -DskipTests


出现的问题:

[ERROR] Failed to execute goal on project flume-ng-morphline-solr-sink: Could not resolve dependencies for project org.apache.flume.flume-ng-sinks:flume-ng-morphline-solr-sink:jar:1.5.0: Failed to collect dependencies for [org.apache.flume:flume-ng-core:jar:1.5.0 (compile), org.slf4j:slf4j-api:jar:1.6.1 (compile), org.kitesdk:kite-morphlines-all:pom:0.12.0 (compile?), org.slf4j:jcl-over-slf4j:jar:1.6.1 (provided), org.apache.solr:solr-test-framework:jar:4.3.0 (test), org.kitesdk:kite-morphlines-solr-core:jar:tests:0.12.0 (test), junit:junit:jar:4.10 (test)]: Failed to read artifact descriptor for ua_parser:ua-parser:jar:1.3.0: Could not transfer artifact ua_parser:ua-parser:pom:1.3.0 from/to maven-twttr (http://maven.twttr.com): Connection to http://maven.twttr.com refused: Connection timed out: connect -> [Help 1]


解决办法:

进入apache-flume-1.5.0-src\flume-ng-sinks\flume-ng-morphline-solr-sink\目录下pom.xml文件:

将<<repositories>>....</repositories>里面的内容注释掉。

然后加上:

<repository>
 <id>p2.jfrog.org</id>
 <url>http://p2.jfrog.org/libs-releases</url>
</repository>




[ERROR] Failed to execute goal on project flume-ng-morphline-solr-sink: Could not resolve dependencies for project org.apache.flume.flume-ng-sinks:flume-ng-morphline-solr-sink:jar:1.5.0: Failed to collect dependencies for [org.apache.flume:flume-ng-core:jar:1.5.0 (compile), org.slf4j:slf4j-api:jar:1.6.1 (compile), org.kitesdk:kite-morphlines-all:pom:0.12.0 (compile?), org.slf4j:jcl-over-slf4j:jar:1.6.1 (provided), org.apache.solr:solr-test-framework:jar:4.3.0 (test), org.kitesdk:kite-morphlines-solr-core:jar:tests:0.12.0 (test), junit:junit:jar:4.10 (test)]: Failed to read artifact descriptor for org.apache.hadoop:hadoop-common:jar:1.0.1: Could not transfer artifact org.apache.hadoop:hadoop-common:pom:1.0.1 from/to maven-twttr (http://maven.twttr.com): Failed to transfer file: http://maven.twttr.com/org/apache/hadoop/hadoop-common/1.0.1/hadoop-common-1.0.1.pom. Return
 code is: 504 , ReasonPhrase:Gateway Timeout. -> [Help 1]


解决办法:

修改apache-flume-1.5.0-src目录下的pom.xml文件,将其中

<kite.version>0.12.0</kite.version>,修改为<kite.version>0.15.0</kite.version>。


如果还有错误的话,修改apache-flume-1.5.0-src\flume-ng-sinks\flume-ng-morphline-solr-sink\目录下pom.xml文件:

添加:

<repository>
<id>maven-restlet</id>
<name>Public online Restlet repository</name>
<url>http://maven.restlet.org</url>
</repository>




出现下面信息,表示编译成功。

[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] Apache Flume ...................................... SUCCESS [1.157s]
[INFO] Flume NG SDK ...................................... SUCCESS [2.330s]
[INFO] Flume NG Configuration ............................ SUCCESS [0.340s]
[INFO] Flume NG Core ..................................... SUCCESS [2.700s]
[INFO] Flume NG Sinks .................................... SUCCESS [0.110s]
[INFO] Flume NG HDFS Sink ................................ SUCCESS [0.480s]
[INFO] Flume NG IRC Sink ................................. SUCCESS [0.210s]
[INFO] Flume NG Channels ................................. SUCCESS [0.070s]
[INFO] Flume NG JDBC channel ............................. SUCCESS [0.270s]
[INFO] Flume NG file-based channel ....................... SUCCESS [0.490s]
[INFO] Flume NG Spillable Memory channel ................. SUCCESS [0.260s]
[INFO] Flume NG Node ..................................... SUCCESS [0.340s]
[INFO] Flume NG Embedded Agent ........................... SUCCESS [0.530s]
[INFO] Flume NG HBase Sink ............................... SUCCESS [0.530s]
[INFO] Flume NG ElasticSearch Sink ....................... SUCCESS [0.380s]
[INFO] Flume NG Morphline Solr Sink ...................... SUCCESS [4.030s]
[INFO] Flume Sources ..................................... SUCCESS [0.070s]
[INFO] Flume Scribe Source ............................... SUCCESS [0.852s]
[INFO] Flume JMS Source .................................. SUCCESS [1.460s]
[INFO] Flume Twitter Source .............................. SUCCESS [0.950s]
[INFO] Flume legacy Sources .............................. SUCCESS [0.050s]
[INFO] Flume legacy Avro source .......................... SUCCESS [1.100s]
[INFO] Flume legacy Thrift Source ........................ SUCCESS [1.190s]
[INFO] Flume NG Clients .................................. SUCCESS [0.060s]
[INFO] Flume NG Log4j Appender ........................... SUCCESS [3.684s]
[INFO] Flume NG Tools .................................... SUCCESS [2.792s]
[INFO] Flume NG distribution ............................. SUCCESS [5.960s]
[INFO] Flume NG Integration Tests ........................ SUCCESS [1.070s]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 33.946s
[INFO] Finished at: Thu Sep 29 12:38:14 CST 2016
[INFO] Final Memory: 75M/1618M
[INFO] ------------------------------------------------------------------------



然后执行下面这个:

E:\software\apache-flume-1.5.0-src>mvn eclipse:eclipse -DdownloadSources


出现下面信息表示成功。

[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] Apache Flume ...................................... SUCCESS [0.785s]
[INFO] Flume NG SDK ...................................... SUCCESS [1:09.714s]
[INFO] Flume NG Configuration ............................ SUCCESS [16.472s]
[INFO] Flume NG Core ..................................... SUCCESS [1:13.887s]
[INFO] Flume NG Sinks .................................... SUCCESS [0.020s]
[INFO] Flume NG HDFS Sink ................................ SUCCESS [2:14.869s]
[INFO] Flume NG IRC Sink ................................. SUCCESS [1.180s]
[INFO] Flume NG Channels ................................. SUCCESS [0.040s]
[INFO] Flume NG JDBC channel ............................. SUCCESS [8.272s]
[INFO] Flume NG file-based channel ....................... SUCCESS [4.770s]
[INFO] Flume NG Spillable Memory channel ................. SUCCESS [0.210s]
[INFO] Flume NG Node ..................................... SUCCESS [2.543s]
[INFO] Flume NG Embedded Agent ........................... SUCCESS [0.290s]
[INFO] Flume NG HBase Sink ............................... SUCCESS [2:38.160s]
[INFO] Flume NG ElasticSearch Sink ....................... SUCCESS [1:59.248s]
[INFO] Flume NG Morphline Solr Sink ...................... SUCCESS [16:15.959s]
[INFO] Flume Sources ..................................... SUCCESS [0.030s]
[INFO] Flume Scribe Source ............................... SUCCESS [0.160s]
[INFO] Flume JMS Source .................................. SUCCESS [7:08.242s]
[INFO] Flume Twitter Source .............................. SUCCESS [31.244s]
[INFO] Flume legacy Sources .............................. SUCCESS [0.030s]
[INFO] Flume legacy Avro source .......................... SUCCESS [0.230s]
[INFO] Flume legacy Thrift Source ........................ SUCCESS [0.140s]
[INFO] Flume NG Clients .................................. SUCCESS [0.020s]
[INFO] Flume NG Log4j Appender ........................... SUCCESS [0.200s]
[INFO] Flume NG Tools .................................... SUCCESS [0.310s]
[INFO] Flume NG distribution ............................. SUCCESS [0.260s]
[INFO] Flume NG Integration Tests ........................ SUCCESS [1.280s]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 33:49.445s
[INFO] Finished at: Thu Sep 29 13:14:57 CST 2016
[INFO] Final Memory: 44M/443M
[INFO] ------------------------------------------------------------------------



上面编译之后,在eclipse下,Import–>Existing Projects into Workspace,然后选择flume编译源码的路径即可,结果如下图所示:






  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值