在Eclipse上建立hadoop2.2.0/hadoop2.4.0原始碼閱讀環境

來源:互聯網
上載者:User

標籤: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,匯入原始碼目錄下的項目.

 

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.