Environment:Apache Shardingsphere Java Runtime Environment
| Knowledge Sources | |
|---|---|
| Domains | Infrastructure, Build |
| Last Updated | 2026-02-10 02:00 GMT |
Overview
Java 8+ runtime environment with Maven 3.0.4+ build tooling for compiling and running Apache ShardingSphere.
Description
This environment defines the base Java platform requirements for all ShardingSphere modules. The project compiles to Java 8 bytecode but supports running on Java 11+ with specific JVM module access flags. Maven 3.9.12 is distributed via the Maven Wrapper. The build uses Lombok for annotation processing and ANTLR4 4.13.2 for SQL parsing grammar generation.
Usage
Use this environment for any ShardingSphere development, compilation, or runtime scenario. All modules including JDBC driver, Proxy server, and Agent require this base Java environment. This is the mandatory prerequisite for every Implementation in the wiki.
System Requirements
| Category | Requirement | Notes |
|---|---|---|
| OS | Linux, macOS, or Windows | No OS-specific restrictions |
| Java | JDK 8+ (JDK 11+ recommended) | Compiles to Java 8 bytecode; JDK 11+ requires module opens |
| Build Tool | Maven 3.0.4+ | Wrapper distributes Maven 3.9.12 |
| Disk | 2GB+ free space | For dependency download and compilation artifacts |
Dependencies
System Packages
- `java` (JDK) >= 8
- `maven` >= 3.0.4 (or use included Maven Wrapper `./mvnw`)
- `git` (for source checkout)
Key Library Dependencies
- `lombok` = 1.18.42
- `antlr4` = 4.13.2
- `guava` = 33.4.6-jre
- `netty` = 4.2.9.Final
- `snakeyaml` = 2.2
- `jackson` = 2.16.1
- `slf4j` = 2.0.17
- `logback` = 1.3.16
- `groovy` = 4.0.22
- `bytebuddy` = 1.17.7
Test Dependencies
- `junit-jupiter` = 5.14.1
- `hamcrest` = 3.0
- `mockito` = 4.11.0
- `awaitility` = 4.3.0
Credentials
No credentials are required for the base Java runtime environment.
Quick Install
# Clone and build ShardingSphere
git clone https://github.com/apache/shardingsphere.git
cd shardingsphere
# Build with Maven Wrapper (skipping tests for speed)
./mvnw install -T1C -DskipTests
# Build with full tests
./mvnw install -T1C
Code Evidence
Java version configuration from `pom.xml:54-57`:
<java.version>8</java.version>
<maven.compiler.source>${java.version}</maven.compiler.source>
<maven.compiler.target>${java.version}</maven.compiler.target>
<maven.compiler.release>${java.version}</maven.compiler.release>
Maven version requirement from `pom.xml:58`:
<maven.version.range>[3.0.4,)</maven.version.range>
JDK 11+ module opens from `pom.xml:1143-1149`:
<argLine>
--add-opens java.base/java.lang=ALL-UNNAMED
--add-opens java.base/java.lang.reflect=ALL-UNNAMED
--add-opens java.base/sun.net=ALL-UNNAMED
--add-opens java.base/java.net=ALL-UNNAMED
-XX:+EnableDynamicAgentLoading
</argLine>
Maven Wrapper version from `.mvn/wrapper/maven-wrapper.properties:3`:
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.12/apache-maven-3.9.12-bin.zip
Common Errors
| Error Message | Cause | Solution |
|---|---|---|
| `source release 8 requires target release 8` | Maven compiler misconfiguration | Ensure `java.version` property is set to `8` in pom.xml |
| `module java.base does not "opens" java.lang` | Running on JDK 11+ without module flags | Add `--add-opens java.base/java.lang=ALL-UNNAMED` to JVM args |
| `UnsupportedClassVersionError` | Running compiled code on older JRE | Ensure JRE version >= 8; check `java -version` |
Compatibility Notes
- JDK 8: Fully supported as the compilation target. All bytecode is Java 8 compatible.
- JDK 11+: Supported with additional `--add-opens` JVM arguments for reflective access. The Maven build activates these automatically via profile detection `[11,)`.
- JDK 17+: Requires `-XX:+EnableDynamicAgentLoading` for ByteBuddy-based agent support.
- Encoding: All source files use UTF-8 encoding (`project.build.sourceEncoding` = UTF-8).
Related Pages
- Implementation:Apache_Shardingsphere_ClusterContextManagerBuilder_Build
- Implementation:Apache_Shardingsphere_ShadowSQLRouter_DecorateRouteContext
- Implementation:Apache_Shardingsphere_MetaDataContextsFactory_Create
- Implementation:Apache_Shardingsphere_ShadowRule_Constructor
- Implementation:Apache_Shardingsphere_YamlEngine_Unmarshal
- Implementation:Apache_Shardingsphere_ClusterPersistRepository_Init
- Implementation:Apache_Shardingsphere_ClusterWorkerIdGenerator_Generate
- Implementation:Apache_Shardingsphere_DataChangedEventListenerRegistry_Register