下载hbase-1.1.2源码:
http://archive.apache.org/dist/hbase/1.1.2/hbase-1.1.2-src.tar.gz
环境配置
参考《hadoop-2.7.3源码编译》中JDK, Maven配置
编译操作
指定Hadoop的依赖版本
将行hbase/pom.xml中的hadoop-two.version属性值修改为要指定的hadoop版本,如下指定2.7.3:
<hadoop-two.version>2.7.3</hadoop-two.version>
编译打包
进入hbase-1.1.2源代码根目录,执行如下命令:
package编译
mvn clean package -DskipTests
编译二进制发行包(tarball包)
mvn clean package -DskipTests assembly:single
注:编译成功后,在hbase-1.1.2/hbase-assembly/target目录下有目标tar包:hbase-1.1.2-bin.tar.gz
结果:
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] Apache HBase ....................................... SUCCESS [ 7.043 s]
[INFO] Apache HBase - Checkstyle .......................... SUCCESS [ 1.407 s]
[INFO] Apache HBase - Resource Bundle ..................... SUCCESS [ 0.401 s]
[INFO] Apache HBase - Annotations ......................... SUCCESS [ 1.490 s]
[INFO] Apache HBase - Protocol ............................ SUCCESS [ 19.640 s]
[INFO] Apache HBase - Common .............................. SUCCESS [ 35.485 s]
[INFO] Apache HBase - Procedure ........................... SUCCESS [ 3.149 s]
[INFO] Apache HBase - Client .............................. SUCCESS [ 14.676 s]
[INFO] Apache HBase - Hadoop Compatibility ................ SUCCESS [ 1.558 s]
[INFO] Apache HBase - Hadoop Two Compatibility ............ SUCCESS [ 5.781 s]
[INFO] Apache HBase - Prefix Tree ......................... SUCCESS [ 3.634 s]
[INFO] Apache HBase - Server .............................. SUCCESS [01:01 min]
[INFO] Apache HBase - Testing Util ........................ SUCCESS [ 3.197 s]
[INFO] Apache HBase - Thrift .............................. SUCCESS [ 13.726 s]
[INFO] Apache HBase - Rest ................................ SUCCESS [ 7.011 s]
[INFO] Apache HBase - Shell ............................... SUCCESS [ 2.544 s]
[INFO] Apache HBase - Integration Tests ................... SUCCESS [ 5.821 s]
[INFO] Apache HBase - Examples ............................ SUCCESS [ 2.869 s]
[INFO] Apache HBase - Assembly ............................ SUCCESS [01:01 min]
[INFO] Apache HBase - Shaded .............................. SUCCESS [ 0.071 s]
[INFO] Apache HBase - Shaded - Client ..................... SUCCESS [ 0.558 s]
[INFO] Apache HBase - Shaded - Server ..................... SUCCESS [ 0.916 s]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 04:17 min
[INFO] Finished at: 2018-01-22T11:14:00+08:00
[INFO] Final Memory: 137M/883M
[INFO] ------------------------------------------------------------------------
QA
- exec-maven-plugin:1.4.0:exec (concat-NOTICE-files)错误
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.4.0:exec (concat-NOTICE-files) on project hbase-assembly: Command execution failed
解决:
vim hbase-assembly/pom.xml
<argument>cat maven-shared-archive-resources/META-INF/NOTICE \
`find ${project.build.directory}/dependency -iname NOTICE -or -iname NOTICE.txt` \
</argument>
修改为:
<argument>cat maven-shared-archive-resources/META-INF/NOTICE \
`find ${project.build.directory}/dependency -iname NOTICE -or -iname NOTICE.txt`
</argument>