---
title: "compile hbase"
author: "leibnitz"
date: "2014-10-15T17:42:43Z"
tags: []
categories: ["编程语言"]
slug: "compile-hbase"
draft: false
lastmod: "2014-10-17T10:19:45Z"
id: 2142898
url: "https://leibnitz.iteye.com/blog/2142898"
---

IF u want to compile a hbase project specified to your own hardware configures(eg. 32 bit jdk to 64),OR release after some changes eg. applied a patch ,optimized some features,u can try this one case.

 

  there are some rough steps to compile a hbase project:

1.download a tarball

  a.u can down it direclty by access apache site ,or

  b.use git to download

 

2.use mvn or IDE to compile

  a.after downloading a raw hbase tarball(if use 1.a),untar it to a dir like hbase-0.94.24.

  b.follow the commands in [apache book](http://hbase.apache.org/book/build.html)

  for instance,u can use this to generate a final deployable tarball:

```
mvn -DskipTests clean install && mvn -DskipTests package assembly:single
```

   after this,u can find some hbase-0.94.24.jar ,hbase-0.94.24.tar.gz under the target dir.untar the later,u will see a final deployable files.

 

   note:with this version,i find a test error in TestRegionObserverScannerOpenHook.java when use

```
mvn test -P runSmallTests 
```

   it complains that null pointer excpetion when executes MiniDFSCluster#startDataNodes(xx...).but if i run it in my eclipse ,it passes without any failures.so u can mv this java test file out of src/test/.... to anywhere.

 

  IDE compile

  a.build  a mvn project that eclipse will recognize by plugin m2e which must be installed previously:

    

```
mvn eclipse:eclipse
```

 

  b.open eclipse,create a project by choosing 'General' -&gt; 'Existing proect into workspace',than find the target mvn project dir

  c.after above steps, u can compile hbase by using eigther eclipse or mvn

 

others 

  of course ,with mvn, u can install snappy compress alogrithm also,see [apache book](http://hbase.apache.org/book/build.html)

  last,u will see there is a dir named '.m2' lied on ~ dir which contains some jar filses,e.g hadoop-test jar ..(downloaded by mvn automatically)