Building and Developing Apache HBase
Developer guide for building, testing, and contributing to Apache HBase.
This chapter provides information for developers who want to build, test, or contribute to Apache HBase.
Getting the Source Code
The HBase source code is managed using Git. The canonical repository is hosted by the Apache Software Foundation.
git clone https://gitbox.apache.org/repos/asf/hbase.git
cd hbaseBuilding HBase
HBase uses Apache Maven for its build system.
Prerequisites
- JDK 8 or later
- Apache Maven 3.0.5 or later
- Internet connection for first build (to download dependencies)
Building from Source
To build HBase from source:
mvn clean package -DskipTestsTo build and run tests:
mvn clean packageTo build distribution artifacts:
mvn clean package -DskipTests assembly:singleRunning Tests
HBase has an extensive test suite including unit tests and integration tests.
Running Unit Tests
Run all unit tests:
mvn testRun tests for a specific module:
mvn test -pl hbase-serverRun a specific test class:
mvn test -Dtest=TestRegionSplittingRunning Integration Tests
Integration tests are longer-running tests that verify end-to-end functionality:
mvn verify -P runAllTestsIDE Setup
IntelliJ IDEA
- Import the project as a Maven project
- Set JDK to version 8 or later
- Enable annotation processing
Eclipse
- Install m2eclipse plugin
- Import as Maven project
- Configure JDK
Code Standards
HBase follows standard Java coding conventions. Key points:
- Use 2 spaces for indentation (not tabs)
- Line length limit of 100 characters
- Follow Java naming conventions
- Add appropriate Javadoc comments
- Include unit tests with code changes
Contributing
Workflow
- File a JIRA issue for your change
- Discuss the approach on the JIRA or dev list if it's a significant change
- Create a patch or pull request
- Respond to code review feedback
- Commit once approved
Submitting Patches
HBase accepts contributions via:
- Git patches attached to JIRA
- Pull requests on GitHub (mirrored to JIRA)
Code Review
All code changes require review before being committed. Reviews happen on JIRA or through GitHub pull requests.
Debugging
Enabling Debug Logging
To enable debug logging for a specific class or package, you can:
- Edit log4j2.properties and restart
- Use the Web UI to change log levels dynamically
- Use the HBase shell
set_log_levelcommand
Using a Debugger
You can attach a remote debugger to HBase processes by setting JAVA_DEBUG options in hbase-env.sh:
export HBASE_MASTER_OPTS="$HBASE_MASTER_OPTS -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=8070"
export HBASE_REGIONSERVER_OPTS="$HBASE_REGIONSERVER_OPTS -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=8071"Then connect your IDE's remote debugger to the appropriate port.
Resources
For more detailed developer information including advanced topics, contribution guidelines, and release procedures, please refer to the HBase developer documentation and community resources.