hadoop2.2.0源码编译笔记

来源:互联网 发布:linux移动目录命令 编辑:程序博客网 时间:2024/06/05 19:37
sudo apt-get install g++ autoconf automake libtool make cmake zlib1g-dev pkg-config libssl-dev
sudo apt-get install ssh
sudo apt-get install protobuf-compiler
sudo apt-get install maven
进入 hadoop-2.2.0-src 目录
mvn package -Pdist,native -DskipTests -Dtar
如果在编译时出现如下的错误:
[INFO] ------------------------------------------------------------------------  
[INFO] BUILD FAILURE  
[INFO] ------------------------------------------------------------------------  
[INFO] Total time: 1:29.469s  
[INFO] Finished at: Mon Nov 18 12:30:36 PST 2013  
[INFO] Final Memory: 37M/120M  
[INFO] ------------------------------------------------------------------------  
[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/chuan/trunk/hadoop-common-project/hadoop-auth/src/test/java/org/apache/hadoop/security/authentication/client/AuthenticatorTestCase.java:[84,13] cannot access org.mortbay.component.AbstractLifeCycle  
[ERROR] class file for org.mortbay.component.AbstractLifeCycle not found  
[ERROR] server = new Server(0);  
[ERROR] /home/chuan/trunk/hadoop-common-project/hadoop-auth/src/test/java/org/apache/hadoop/security/authentication/client/AuthenticatorTestCase.java:[94,29] cannot access org.mortbay.component.LifeCycle  
[ERROR] class file for org.mortbay.component.LifeCycle not found  
[ERROR] server.getConnectors()[0].setHost(host);  
[ERROR] /home/chuan/trunk/hadoop-common-project/hadoop-auth/src/test/java/org/apache/hadoop/security/authentication/client/AuthenticatorTestCase.java:[96,10] cannot find symbol  
[ERROR] symbol  : method start()  
[ERROR] location: class org.mortbay.jetty.Server  
[ERROR] /home/chuan/trunk/hadoop-common-project/hadoop-auth/src/test/java/org/apache/hadoop/security/authentication/client/AuthenticatorTestCase.java:[102,12] cannot find symbol  
[ERROR] symbol  : method stop()  




目前的2.2.0 的Source Code 压缩包解压出来的code有个bug 需要patch后才能编译。否则编译hadoop-auth 会提示上面错误。
解决办法如下:


修改下面的pom文件。该文件在hadoop源码包下寻找:




hadoop-common-project/hadoop-auth/pom.xml
打开上面的的pom文件,在56行加入如下的依赖:


     <dependency>
       <groupId>org.mortbay.jetty</groupId>
      <artifactId>jetty-util</artifactId>
      <scope>test</scope>
     </dependency>
     <dependency>
       <groupId>org.mortbay.jetty</groupId>
       <artifactId>jetty</artifactId>
       <scope>test</scope>
     </dependency>


重新编译
编译好的文件位于 hadoop-2.2.0-src/hadoop-dist/target/hadoop-2.2.0/ 目录中
0 0
原创粉丝点击