-
Notifications
You must be signed in to change notification settings - Fork 1
Migrating from Spring Cloud Contract
Stubborn Contract is the official continuation of Spring Cloud Contract. The migration is mostly mechanical — a set of find-and-replace operations across your pom.xml / build.gradle and Java imports.
| Spring Cloud Contract | Stubborn Contract |
|---|---|
org.springframework.cloud:spring-cloud-starter-contract-verifier |
sh.stubborn:stubborn-starter-contract-verifier |
org.springframework.cloud:spring-cloud-starter-contract-stub-runner |
sh.stubborn:stubborn-starter-contract-stub-runner |
org.springframework.cloud:spring-cloud-contract-wiremock |
sh.stubborn:stubborn-contract-wiremock |
org.springframework.cloud:spring-cloud-contract-spec |
sh.stubborn:stubborn-contract-spec |
org.springframework.cloud:spring-cloud-contract-converters |
sh.stubborn:stubborn-contract-converters |
org.springframework.cloud:spring-cloud-contract-stub-runner |
sh.stubborn:stubborn-stub-runner |
Version: use 0.1.0-SNAPSHOT (or the latest release) from:
<repository>
<id>central-snapshots</id>
<url>https://central.sonatype.com/repository/maven-snapshots/</url>
</repository><!-- Before -->
<plugin>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-contract-maven-plugin</artifactId>
<version>5.x.x</version>
<extensions>true</extensions>
</plugin>
<!-- After -->
<plugin>
<groupId>sh.stubborn</groupId>
<artifactId>stubborn-contract-maven-plugin</artifactId>
<version>0.1.0-SNAPSHOT</version>
<extensions>true</extensions>
</plugin>// Before
plugins {
id 'org.springframework.cloud.contract' version '5.x.x'
}
// After
plugins {
id 'sh.stubborn.contract' version '0.1.0-SNAPSHOT'
}Replace all occurrences of org.springframework.cloud.contract with sh.stubborn.contract.
# Quick grep to find all affected files
grep -r "org.springframework.cloud.contract" src/ --include="*.java" --include="*.groovy" --include="*.kt" -l// Before
import org.springframework.cloud.contract.spec.Contract;
import org.springframework.cloud.contract.verifier.messaging.boot.AutoConfigureMessageVerifier;
import org.springframework.cloud.contract.stubrunner.spring.AutoConfigureStubRunner;
// After
import sh.stubborn.contract.spec.Contract;
import sh.stubborn.contract.verifier.messaging.boot.AutoConfigureMessageVerifier;
import sh.stubborn.contract.stubrunner.spring.AutoConfigureStubRunner;For .groovy and .kts contract files, update the import at the top:
// Before
import org.springframework.cloud.contract.spec.Contract
// After
import sh.stubborn.contract.spec.ContractFor .kts (Kotlin DSL):
// Before
import org.springframework.cloud.contract.spec.Contract
// After
import sh.stubborn.contract.spec.ContractYAML contracts require no changes — the YAML format is identical.
spring.cloud.contract.* properties in application.yml / application.properties do not change. These are user-facing configuration keys and are preserved for backward compatibility.
# This stays exactly as-is
spring:
cloud:
contract:
stub-runner:
ids: com.example:my-service:+:stubsStubs generated by Spring Cloud Contract 5.x embed "spring-cloud-contract" as the custom matcher name. Stubborn's stub runner registers a backward-compatibility alias under that name, so existing stubs work without modification.
New stubs generated by Stubborn use "stubborn-contract". Both names are supported simultaneously.
<!-- Before -->
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-dependencies</artifactId>
<version>2025.x.x</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<!-- After — Stubborn BOM (optional, for version alignment) -->
<dependencyManagement>
<dependencies>
<dependency>
<groupId>sh.stubborn</groupId>
<artifactId>stubborn-dependencies</artifactId>
<version>0.1.0-SNAPSHOT</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>- Update Maven/Gradle coordinates (
org.springframework.cloud→sh.stubborn) - Update Maven plugin
groupIdandartifactId - Update Gradle plugin id (
org.springframework.cloud.contract→sh.stubborn.contract) - Replace all Java/Groovy/Kotlin imports (
org.springframework.cloud.contract.*→sh.stubborn.contract.*) - Update
.groovy/.ktscontract DSL imports - Add Maven Central snapshot repository if using snapshots
- Leave
spring.cloud.contract.*properties unchanged - Leave YAML contracts unchanged
- Existing WireMock stubs work as-is (no migration needed)
- stubborn-samples — working examples of producer and consumer setups
- Issue #27 — SCC 5.x ↔ Stubborn interoperability tests