Testcontainers BOM provides centralized dependency management for all Testcontainers modules in Java testing projects
npx @tessl/cli install tessl/maven-org-testcontainers--testcontainers-bom@1.21.0Testcontainers BOM (Bill of Materials) provides centralized dependency management for the entire Testcontainers ecosystem in Java projects. It ensures consistent versions across all Testcontainers modules, eliminating version conflicts and simplifying dependency management in complex testing scenarios.
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.testcontainers</groupId>
<artifactId>testcontainers-bom</artifactId>
<version>1.21.3</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>dependencies {
implementation platform('org.testcontainers:testcontainers-bom:1.21.3')
}<!-- After importing BOM in dependencyManagement -->
<dependencies>
<!-- No version needed - managed by BOM -->
<dependency>
<groupId>org.testcontainers</groupId>
<artifactId>junit-jupiter</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.testcontainers</groupId>
<artifactId>postgresql</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.testcontainers</groupId>
<artifactId>kafka</artifactId>
<scope>test</scope>
</dependency>
</dependencies>// After importing platform
dependencies {
testImplementation 'org.testcontainers:junit-jupiter'
testImplementation 'org.testcontainers:postgresql'
testImplementation 'org.testcontainers:kafka'
}The Testcontainers BOM operates as a Maven/Gradle dependency management artifact that:
Provides Maven <dependencyManagement> integration for centralized version control.
<!-- BOM Import Pattern -->
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.testcontainers</groupId>
<artifactId>testcontainers-bom</artifactId>
<version>1.21.3</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<!-- Usage Pattern (version managed by BOM) -->
<dependency>
<groupId>org.testcontainers</groupId>
<artifactId>MODULE_NAME</artifactId>
<scope>test</scope>
</dependency>Supports Gradle's platform mechanism for dependency management.
// Platform Import Pattern
dependencies {
implementation platform('org.testcontainers:testcontainers-bom:1.21.3')
}
// Usage Pattern (version managed by platform)
dependencies {
testImplementation 'org.testcontainers:MODULE_NAME'
}Manages versions for the complete Testcontainers module ecosystem.
<!-- Core Testcontainers functionality -->
<artifactId>testcontainers</artifactId>
<artifactId>junit-jupiter</artifactId><!-- Relational Databases -->
<artifactId>postgresql</artifactId>
<artifactId>mysql</artifactId>
<artifactId>mariadb</artifactId>
<artifactId>mssqlserver</artifactId>
<artifactId>oracle-xe</artifactId>
<artifactId>oracle-free</artifactId>
<artifactId>db2</artifactId>
<!-- NoSQL Databases -->
<artifactId>mongodb</artifactId>
<artifactId>cassandra</artifactId>
<artifactId>neo4j</artifactId>
<artifactId>couchbase</artifactId>
<artifactId>orientdb</artifactId>
<!-- Time Series and Analytics -->
<artifactId>influxdb</artifactId>
<artifactId>clickhouse</artifactId>
<artifactId>questdb</artifactId>
<artifactId>timeplus</artifactId>
<!-- Distributed Databases -->
<artifactId>cockroachdb</artifactId>
<artifactId>cratedb</artifactId>
<artifactId>scylladb</artifactId>
<artifactId>tidb</artifactId>
<artifactId>yugabytedb</artifactId>
<artifactId>oceanbase</artifactId>
<artifactId>databend</artifactId><!-- Message Brokers -->
<artifactId>kafka</artifactId>
<artifactId>rabbitmq</artifactId>
<artifactId>pulsar</artifactId>
<artifactId>redpanda</artifactId>
<artifactId>activemq</artifactId>
<artifactId>hivemq</artifactId>
<artifactId>solace</artifactId><!-- Search Engines -->
<artifactId>elasticsearch</artifactId>
<artifactId>solr</artifactId>
<artifactId>typesense</artifactId><!-- Cloud Services -->
<artifactId>localstack</artifactId>
<artifactId>azure</artifactId>
<artifactId>gcloud</artifactId>
<!-- Infrastructure Services -->
<artifactId>vault</artifactId>
<artifactId>consul</artifactId>
<artifactId>nginx</artifactId>
<artifactId>grafana</artifactId><!-- Vector Databases -->
<artifactId>chromadb</artifactId>
<artifactId>milvus</artifactId>
<artifactId>pinecone</artifactId>
<artifactId>qdrant</artifactId>
<artifactId>weaviate</artifactId>
<!-- AI Services -->
<artifactId>ollama</artifactId>
<artifactId>openfga</artifactId><!-- Browser Testing -->
<artifactId>selenium</artifactId>
<!-- Testing Utilities -->
<artifactId>mockserver</artifactId>
<artifactId>toxiproxy</artifactId>
<artifactId>k6</artifactId>
<!-- Framework Integrations -->
<artifactId>spock</artifactId>
<artifactId>jdbc</artifactId>
<artifactId>r2dbc</artifactId>
<artifactId>database-commons</artifactId><!-- Kubernetes -->
<artifactId>k3s</artifactId><!-- Object Storage -->
<artifactId>minio</artifactId>
<!-- Other Storage -->
<artifactId>dynalite</artifactId><!-- Authentication -->
<artifactId>ldap</artifactId><!-- SQL Engines -->
<artifactId>presto</artifactId>
<artifactId>trino</artifactId>Ensures version consistency across multiple Testcontainers dependencies.
<!-- Example: Multiple modules use consistent versions -->
<dependencies>
<!-- All will use version 1.21.3 managed by BOM -->
<dependency>
<groupId>org.testcontainers</groupId>
<artifactId>testcontainers</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.testcontainers</groupId>
<artifactId>postgresql</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.testcontainers</groupId>
<artifactId>kafka</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.testcontainers</groupId>
<artifactId>selenium</artifactId>
<scope>test</scope>
</dependency>
</dependencies><!-- pom.xml -->
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.testcontainers</groupId>
<artifactId>testcontainers-bom</artifactId>
<version>1.21.3</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<dependency>
<groupId>org.testcontainers</groupId>
<artifactId>junit-jupiter</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.testcontainers</groupId>
<artifactId>postgresql</artifactId>
<scope>test</scope>
</dependency>
</dependencies><!-- Parent pom.xml -->
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.testcontainers</groupId>
<artifactId>testcontainers-bom</artifactId>
<version>1.21.3</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<!-- Module A pom.xml -->
<dependencies>
<dependency>
<groupId>org.testcontainers</groupId>
<artifactId>mysql</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<!-- Module B pom.xml -->
<dependencies>
<dependency>
<groupId>org.testcontainers</groupId>
<artifactId>kafka</artifactId>
<scope>test</scope>
</dependency>
</dependencies>// build.gradle (root)
subprojects {
dependencies {
implementation platform('org.testcontainers:testcontainers-bom:1.21.3')
}
}
// Module specific build.gradle files
dependencies {
testImplementation 'org.testcontainers:junit-jupiter'
testImplementation 'org.testcontainers:postgresql'
testImplementation 'org.testcontainers:kafka'
}