编译HBase2.2依赖Hadoop3.2通过

1、使用cygwin或者mingw(git bash自带)代替windows命令行

cygwin切换盘符  cd   d:

mingw切换盘符  cd   /d 或者    cd   d:

2、下载Maven3.6.1并配置环境变量

设置aliyun镜像仓库到settings.xml

3、下载hbase2.2.0源码

hbase-2.2.0-src.tar.gz

解压后,通过git bash切cd 换到hbase-2.2.0-src根目录,

http://mirror.bit.edu.cn/apache/hbase/2.2.0/hbase-2.2.0-src.tar.gz

mvn clean package -DskipTests assembly:single -Dhadoop.profile=3.0 -Dhadoop-three.version=3.2.0

伴随一堆warning之后,迎来打包成功:

[INFO]
[INFO] --- maven-site-plugin:3.7.1:attach-descriptor (attach-descriptor) @ hbase-archetype-builder ---
[INFO] No site descriptor found: nothing to attach.
[INFO]
[INFO] --- maven-assembly-plugin:3.0.0:single (default-cli) @ hbase-archetype-builder ---
[INFO] Assemblies have been skipped per configuration of the skipAssembly parameter.
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary for Apache HBase 2.2.0:
[INFO]
[INFO] Apache HBase ....................................... SUCCESS [ 11.267 s]
[INFO] Apache HBase - Checkstyle .......................... SUCCESS [  2.782 s]
[INFO] Apache HBase - Annotations ......................... SUCCESS [  5.016 s]
[INFO] Apache HBase - Build Configuration ................. SUCCESS [  0.141 s]
[INFO] Apache HBase - Shaded Protocol ..................... SUCCESS [ 41.043 s]
[INFO] Apache HBase - Common .............................. SUCCESS [ 47.867 s]
[INFO] Apache HBase - Metrics API ......................... SUCCESS [  2.044 s]
[INFO] Apache HBase - Hadoop Compatibility ................ SUCCESS [  2.981 s]
[INFO] Apache HBase - Metrics Implementation .............. SUCCESS [  2.202 s]
[INFO] Apache HBase - Hadoop Two Compatibility ............ SUCCESS [  4.740 s]
[INFO] Apache HBase - Protocol ............................ SUCCESS [ 12.838 s]
[INFO] Apache HBase - Client .............................. SUCCESS [ 13.575 s]
[INFO] Apache HBase - Zookeeper ........................... SUCCESS [  3.362 s]
[INFO] Apache HBase - Replication ......................... SUCCESS [  2.282 s]
[INFO] Apache HBase - Resource Bundle ..................... SUCCESS [  0.266 s]
[INFO] Apache HBase - HTTP ................................ SUCCESS [  8.627 s]
[INFO] Apache HBase - Procedure ........................... SUCCESS [  3.125 s]
[INFO] Apache HBase - Server .............................. SUCCESS [ 49.173 s]
[INFO] Apache HBase - MapReduce ........................... SUCCESS [  8.902 s]
[INFO] Apache HBase - Testing Util ........................ SUCCESS [  3.098 s]
[INFO] Apache HBase - Thrift .............................. SUCCESS [ 12.766 s]
[INFO] Apache HBase - RSGroup ............................. SUCCESS [  5.234 s]
[INFO] Apache HBase - Shell ............................... SUCCESS [  4.360 s]
[INFO] Apache HBase - Coprocessor Endpoint ................ SUCCESS [  5.703 s]
[INFO] Apache HBase - Integration Tests ................... SUCCESS [  7.250 s]
[INFO] Apache HBase - Rest ................................ SUCCESS [  5.958 s]
[INFO] Apache HBase - Examples ............................ SUCCESS [  4.859 s]
[INFO] Apache HBase - Shaded .............................. SUCCESS [  0.328 s]
[INFO] Apache HBase - Shaded - Client (with Hadoop bundled) SUCCESS [ 34.757 s]
[INFO] Apache HBase - Shaded - Client ..................... SUCCESS [ 11.793 s]
[INFO] Apache HBase - Shaded - MapReduce .................. SUCCESS [ 16.156 s]
[INFO] Apache HBase - External Block Cache ................ SUCCESS [  2.360 s]
[INFO] Apache HBase - Assembly ............................ SUCCESS [02:12 min]
[INFO] Apache HBase Shaded Packaging Invariants ........... SUCCESS [  1.953 s]
[INFO] Apache HBase Shaded Packaging Invariants (with Hadoop bundled) SUCCESS [  0.346 s]
[INFO] Apache HBase - Archetypes .......................... SUCCESS [  0.063 s]
[INFO] Apache HBase - Exemplar for hbase-client archetype . SUCCESS [  2.142 s]
[INFO] Apache HBase - Exemplar for hbase-shaded-client archetype SUCCESS [  0.875 s]
[INFO] Apache HBase - Archetype builder ................... SUCCESS [  2.031 s]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  08:04 min
[INFO] Finished at: 2019-06-27T23:36:04+08:00
[INFO] ------------------------------------------------------------------------

$ls  ./hbase-assembly/target

archive-tmp  dependency-maven-plugin-markers  hbase-2.2.0-client-bin.tar.gz   NOTICE.aggregate
dependency   hbase-2.2.0-bin.tar.gz           maven-shared-archive-resources  supplemental-models.xml

源码里面的zookeeper.version是 3.4.10,改成3.4.14并修改POM如下:

3.4.14

 

     
        org.apache.zookeeper
        zookeeper
        ${zookeeper.version}
       
             
                com.google.code.findbugs
                jsr305
             

         

特别说明:使用windows的cmd编译在Assembly阶段报错:env命令无法执行

附:Hbase官方参考

你可能感兴趣的:(Maven,hadoop,Hbase)