spring-cloud-contract

Spring cloud contract with common contract repository


I Created a sperate repository to store the contract as descibed in this link: https://github.com/spring-cloud/spring-cloud-contract/tree/main/samples/standalone/contracts

In the producer side, I added the generated jar of contract as follow:

<plugin>
    <groupId>org.springframework.cloud</groupId>
    <artifactId>spring-cloud-contract-maven-plugin</artifactId>
    <configuration>
        <contractsMode>LOCAL</contractsMode>
        <contractDependency>
            <groupId>com.example.standalone</groupId>
            <artifactId>contracts</artifactId>
        </contractDependency>
    </configuration>
</plugin>

When I execute the maven install, this doesn't generate the contracts verifier classes in the target folder. any help? Thanks


Solution

  • Please check the sample in spring-cloud-contract-samples repo producer with external contracts

    The beer contracts folder contains only contract definitions - it will not generate any test classes.

    This project producer with external contracts will generate test classes from the contracts defined in this beer contracts folder.