红联Linux门户
Linux帮助

Maven编译hadoop-2.6.4源码

发布时间:2016-08-01 15:06:59来源:linux网站作者:sz-lcw
(这里我们选择linux环境,在windows环境将会麻烦很多)
 
下载源代码:http://hadoop.apache.org/releases.html
编译Hadoop源码的所需环境和工具在文件目录下的BUILDING.txt(基本上编译的相关事项都能在这里面找到)里面有:
Requirements:
* Unix System
* JDK 1.6+
* Maven 3.0 or later
* Findbugs 1.3.9 (if running findbugs)
* ProtocolBuffer 2.5.0
* CMake 2.6 or newer (if compiling native code), must be 3.0 or newer on Mac
* Zlib devel (if compiling native code)
* openssl devel ( if compiling native hadoop-pipes )
* Internet connection for first build (to fetch all Maven and Hadoop dependencies)
这里讲讲在ubuntu里面下载以上要求的几个工具,命令行下运行一下指令:
sudo apt-get install maven  
sudo apt-get install findbugs  
sudo apt-get install cmake  
sudo apt-get install zlib1g-dev  
sudo apt-get install libssl-dev  
然后在命令行模式的hadoop源文件目录下运行:
mvn package -Pdist -DskipTests -Dtar  
编译出现错误有一个是因为jdk8的原因:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-javadoc-plugin:2.8.1:jar (module-javadocs) on project hadoop-nfs: MavenReportException: Error while creating archive:
java8在对Javadoc上更加严格,导致编译的时候会出现问题,如no description for @param 等等:
Maven编译hadoop-2.6.4源码
 
解决办法:
mvn -Dmaven.javadoc.skip=true verify  
或者在原来编译语句基础上添加-Dmaven.javadoc.skip=true
mvn package -Pdist -DskipTests -Dtar -Dmaven.javadoc.skip=true  
然后就是漫长的等待,直到它编译成功!成功后,生成的bin文件的路径在:hadoop-2.6.4-src/hadoop-dist/target/下。
Maven编译hadoop-2.6.4源码
 
本文永久更新地址:http://www.linuxdiyf.com/linux/22911.html