Skip to content

Migrating from Spring Cloud Contract

Marcin Grzejszczak edited this page Jul 12, 2026 · 1 revision

Migrating from Spring Cloud Contract to Stubborn 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.


1. Maven coordinates

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>

2. Maven plugin

<!-- 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>

3. Gradle plugin

// Before
plugins {
    id 'org.springframework.cloud.contract' version '5.x.x'
}

// After
plugins {
    id 'sh.stubborn.contract' version '0.1.0-SNAPSHOT'
}

4. Java imports

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;

5. Groovy / Kotlin / YAML DSL contracts

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.Contract

For .kts (Kotlin DSL):

// Before
import org.springframework.cloud.contract.spec.Contract

// After
import sh.stubborn.contract.spec.Contract

YAML contracts require no changes — the YAML format is identical.


6. Spring Boot property prefixes — NO CHANGE NEEDED

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:+:stubs

7. WireMock stubs — backward compatible

Stubs 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.


8. Dependency management / BOM

<!-- 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>

9. Quick checklist

  • Update Maven/Gradle coordinates (org.springframework.cloudsh.stubborn)
  • Update Maven plugin groupId and artifactId
  • Update Gradle plugin id (org.springframework.cloud.contractsh.stubborn.contract)
  • Replace all Java/Groovy/Kotlin imports (org.springframework.cloud.contract.*sh.stubborn.contract.*)
  • Update .groovy / .kts contract 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)

See also

  • stubborn-samples — working examples of producer and consumer setups
  • Issue #27 — SCC 5.x ↔ Stubborn interoperability tests