A Bill of Materials (BOM) is a standard Maven feature that provides centralized dependency version management. ShardingSphere BOM ensures that all modules use compatible versions, eliminating version conflicts and simplifying dependency management.
The ShardingSphere BOM (shardingsphere-bom) is a POM file that contains version information for all ShardingSphere modules. By importing the BOM in your project, you no longer need to specify versions for individual ShardingSphere dependencies.
To use ShardingSphere BOM in your Maven project, add the following to your pom.xml:
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.apache.shardingsphere</groupId>
<artifactId>shardingsphere-bom</artifactId>
<version>${shardingsphere.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
After importing the BOM, you can declare ShardingSphere dependencies without versions:
<dependencies>
<!-- ShardingSphere JDBC Driver -->
<dependency>
<groupId>org.apache.shardingsphere</groupId>
<artifactId>shardingsphere-jdbc</artifactId>
</dependency>
<!-- ShardingSphere Parser for MySQL -->
<dependency>
<groupId>org.apache.shardingsphere</groupId>
<artifactId>shardingsphere-parser-sql-engine-mysql</artifactId>
</dependency>
<!-- Data Source Pool Implementation -->
<dependency>
<groupId>org.apache.shardingsphere</groupId>
<artifactId>shardingsphere-infra-data-source-pool-hikari</artifactId>
</dependency>
</dependencies>
For Gradle users, you can use the BOM through the dependencyManagement plugin:
plugins {
id 'java'
id 'io.spring.dependency-management' version '1.0.11.RELEASE'
}
dependencyManagement {
imports {
mavenBom "org.apache.shardingsphere:shardingsphere-bom:${shardingsphereVersion}"
}
}
dependencies {
implementation 'org.apache.shardingsphere:shardingsphere-jdbc'
implementation 'org.apache.shardingsphere:shardingsphere-parser-sql-engine-mysql'
}
