在Eclipse上建立hadoop2.2.0/hadoop2.4.0源代码阅读环境
1.安装依赖的包:
yum install gcc-c++ g++ autoconf automake libtool cmake zlib1g-dev pkg-config libssl-dev
2. 安装protobuf 2.5.0,
首先去google的网站上下载protobuf源代码,解压并切换到root用户执行如下命令:
./configure
如果中间发生错误,说明有些依赖包并为安装,
an error occured because dependency is not met
the error is cleaned
把所须依赖都安装好之后,执行:
./make ./make install
3.编译Hadoop源代码
首先下载hadoop-2.2.0的源代码,解压。
2.1. 切换到源代码目录,执行:
mvn install -DskipTests -Dhttp.proxyHost=proxy01.cd.intel.com -Dhttp.proxyPort=911
黄色部分作用为设置代理。由于本人的编译环境在公司内网,所以需要设置代理
发现如下错误:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.5.1:testCompile (default-testCompile) on project hadoop-auth: Compilation failure: Compilation failure: [ERROR] /home/hduser/hadoop-2.2.0-src/hadoop-common-project/hadoop-auth/src/test/java/org/apache/hadoop/security/authentication/client/AuthenticatorTestCase.java:[88,11] error: cannot access AbstractLifeCycle [ERROR] class file for org.mortbay.component.AbstractLifeCycle not found [ERROR] /home/hduser/hadoop-2.2.0-src/hadoop-common-project/hadoop-auth/src/test/java/org/apache/hadoop/security/authentication/client/AuthenticatorTestCase.java:[96,29] error: cannot access LifeCycle [ERROR] class file for org.mortbay.component.LifeCycle not found [ERROR] /home/hduser/hadoop-2.2.0-src/hadoop-common-project/hadoop-auth/src/test/java/org/apache/hadoop/security/authentication/client/AuthenticatorTestCase.java:[98,10] error: cannot find symbol [ERROR] symbol: method start() [ERROR] location: variable server of type Server [ERROR] /home/hduser/hadoop-2.2.0-src/hadoop-common-project/hadoop-auth/src/test/java/org/apache/hadoop/security/authentication/client/AuthenticatorTestCase.java:[104,12] error: cannot find symbol [ERROR] -> [Help 1]
需要修改源码下边的hadoop-common-project/hadoop-auth/pom.xml,黄色部分为新增代码
<dependency>
<groupId>org.mortbay.jetty</groupId>
<artifactId>jetty</artifactId>
<scope>test</scope>
</dependency>
<dependency> <groupId>org.mortbay.jetty</groupId> <artifactId>jetty-util</artifactId> <scope>test</scope> </dependency>
重新执行,顺利通过
2.2. 生成eclipse项目环境:
mvn eclipse:eclipse -DskipTests -Dhttp.proxyHost=proxy01.cd.intel.com -Dhttp.proxyPort=911
2.3. 打开eclipse,导入源代码目录下的项目.
郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。