参考文档:https://diary-of-programmer.blogspot.com/2014/11/hadoop-tips-hadoop-build-error-related-findbugs-protobuf-avro.html
terminal 编译hadoop:
yum -y install zlib-devel autoconf automake cmake libtool openssl-deve
按照BUILDING.txt的要求
Requirements:
* Unix System
* JDK 1.7+
* 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 and to get the best HDFS encryption performance)
* Linux FUSE (Filesystem in Userspace) version 2.6 or above (if compiling fuse_dfs)
* Internet connection for first build (to fetch all Maven and Hadoop dependencies)
只少需要java ,maven ,protocolbuffer cmake ,zlib ,openssl
安装完后执行:
mvn package -Pdist,native,src -DskipTests -Dtar
需要下载很多东西,请保持足够的空间。
Eclipse:
Importing projects to eclipse
When you import the project to eclipse, install hadoop-maven-plugins at first.
$ cd hadoop-maven-plugins
$ mvn install
Then, generate eclipse project files.
进入到root ,src 目录下
$ mvn eclipse:eclipse -DskipTests
At last, import to eclipse by specifying the root directory of the project via
[File] > [Import] > [Existing Projects into Workspace].
发现有很多错误
1、访问限制的错误,到windows->preferences->java->compiler->Errors/warning 下Deprecated and restricated api ,Forbidden reference 改为warning.
2、source file missing , 到build path remove 到引用
3、class can't find . 在 root src 目录下 搜索 对应java 文件。例如AvroRecord.java TestProtos.java 拷贝到对应目录。2.8.0 在grepcode.com 代码目前还没有,之前的版本也可以在grepcode.com 下载对应文件