標籤:style class blog code http java
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 metthe 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,匯入原始碼目錄下的項目.