Prerequisites
Java 21 is required to build and test HiveMQ, even though Java 11 is sufficient to run it.
Required Tools
- Java Development Kit (JDK) 21: Download from Eclipse Temurin
- Git: For cloning the repository
- Gradle: Included via Gradle Wrapper (
gradlew)
Clone the Repository
Clone the HiveMQ Community Edition repository from GitHub:Build Targets
HiveMQ uses Gradle as its build system. The project includes several build targets for different outputs.Build the Binary Package
Create a distributable ZIP package:build/distributions/hivemq-ce-<version>.zip
This creates a complete HiveMQ distribution including:
- Executable JAR (
hivemq.jar) - Startup scripts (
run.sh,run.bat) - Configuration files
- Directory structure
- Software Bill of Materials (SBOM)
Extract and Run
After building, extract and run HiveMQ:Build the Docker Image
Build a local Docker image:hivemq/hivemq-ce:snapshot
Run the locally built image:
Other Build Tasks
Compile Sources
Compile the Java sources without creating a distribution:HiveMQ compiles to Java 11 bytecode for runtime compatibility, even though the build requires Java 21.
Build JAR File
Create the HiveMQ JAR:build/libs/hivemq-community-edition-<version>-all.jar
The shadow JAR includes all dependencies merged into a single executable JAR.
Run Tests
Execute the test suite:- Minimum heap: 128m
- Maximum heap: 2048m
- Special JVM flags for module access
build/reports/tests/test/index.html
Generate Javadoc
Generate API documentation:build/docs/javadoc/
Code Quality Checks
Run code formatting and quality checks:build/reports/jacoco/test/html/index.html
Build Configuration
Project Information
- Group:
com.hivemq - Artifact ID:
hivemq-community-edition - License: Apache 2.0
- Main Class:
com.hivemq.HiveMQServer
Java Toolchain
The build uses a sophisticated toolchain setup:Key Dependencies
Networking
Networking
- Netty (buffer, codec, handler, transport)
- High-performance async I/O framework
Persistence
Persistence
- RocksDB: High-performance embedded database
- Xodus: Transactional schema-less embedded database
Security
Security
- Bouncy Castle (provider, PKIX)
- Cryptography and TLS support
Logging
Logging
- SLF4J API
- Logback Classic
- JUL to SLF4J bridge
Metrics
Metrics
- Dropwizard Metrics (core, JMX, Logback)
- OSHI (system and hardware information)
Dependency Injection
Dependency Injection
- Google Guice
- JSR-330 (javax.inject)
Gradle Wrapper
The project includes Gradle Wrapper for consistent builds:Common Build Tasks
Continuous Integration
The project uses GitHub Actions for CI/CD. See.github/workflows/check.yml for the complete workflow.
Publishing
Maven Publications
Two artifacts are published:- Distribution:
hivemq-community-edition(ZIP package) - Embedded:
hivemq-community-edition-embedded(JAR for embedded use)
Signing
Artifacts are signed with PGP:Development Workflow
Troubleshooting
Build Fails with Java Version Error
Problem:Unsupported class file major version
Solution: Ensure you’re using Java 21 for building:
Out of Memory During Build
Problem:OutOfMemoryError during compilation or tests
Solution: Increase Gradle JVM memory:
gradle.properties:
Test Failures
Problem: Specific tests fail on your system Solution: Use test inclusion/exclusion files:Next Steps
Contributing
Read the contribution guidelines
Binary Deployment
Deploy the built package
Extension Development
Develop custom extensions
Testing
Write and run tests