This version is still in development and is not considered stable yet. For the latest stable version, please use spring-cloud-contract 4.1.5! |
How to Build Spring Cloud Contract
Cloning the repository on Windows
While cloning this project on Windows, some files in the git repository may exceed the Windows maximum file path limit of 255 characters, which may result in an incorrectly (probably partially) checked out repository.
To resolve this issue, you can set the core.longPaths
attribute to true
or clone the Spring Cloud Contract repository.
To set the core.longPaths
attribute to true
, you have three options:
-
Change it for all users of the machine (doing so requires administrator privileges):
git config --system core.longPaths true
git clone https://github.com/spring-cloud/spring-cloud-contract.git
-
Change it for the current user (no administrative privileges required):
git config --global core.longPaths true
git clone https://github.com/spring-cloud/spring-cloud-contract.git
-
Change for just this repository (administrative privileges depend on where the repository is being cloned to):
git clone -c core.longPaths=true https://github.com/spring-cloud/spring-cloud-contract.git
You need to have all the necessary Groovy plugins installed for your IDE to properly resolve the sources. For example, in Intellij IDEA, having both the Eclipse Groovy Compiler Plugin and the GMavenPlus Intellij Plugin results in properly imported project. |
Spring Cloud Contract builds Docker images. Remember to have Docker installed. |
If you want to run the build in offline mode, you must have Maven 3.5.2+ installed. |
Project structure
The following listing shows the Spring Cloud Contract folder structure:
├── config
├── docker
├── samples
├── scripts
├── specs
├── spring-cloud-contract-dependencies
├── spring-cloud-contract-shade
├── spring-cloud-contract-starters
├── spring-cloud-contract-stub-runner
├── spring-cloud-contract-stub-runner-boot
├── spring-cloud-contract-tools
├── spring-cloud-contract-verifier
├── spring-cloud-contract-wiremock
└── tests
The following list describes each of the top-level folders in the project structure:
-
config
: Folder contains setup for Spring Cloud Release Tools automated release process -
docker
: Folder contains docker images -
scripts
: Contains scripts to build and testSpring Cloud Contract
with Maven, Gradle -
specs
: Contains specifications for the Contract DSL. -
spring-cloud-contract-dependencies
: Contains Spring Cloud Contract BOM -
spring-cloud-contract-shade
: Shaded dependencies used by the plugins -
spring-cloud-contract-starters
: Contains Spring Cloud Contract Starters -
spring-cloud-contract-spec
: Contains specification modules (contains concept of a Contract) -
spring-cloud-contract-stub-runner
: Contains Stub Runner related modules -
spring-cloud-contract-stub-runner-boot
: Contains Stub Runner Boot app -
spring-cloud-contract-tools
: Gradle and Maven plugin forSpring Cloud Contract Verifier
-
spring-cloud-contract-verifier
: Core of theSpring Cloud Contract Verifier
functionality -
spring-cloud-contract-wiremock
: All WireMock related functionality -
tests
: Integration tests for different messaging technologies
Commands
To build the core functionality together with the Maven Plugin, you can run the following command:
./mvnw clean install -P integration
Calling that function builds the core, the Maven plugin, and the Gradle plugin.
To build only the Gradle Plugin, you can run the following commands:
cd spring-cloud-contract-tools/spring-cloud-contract-gradle-plugin
./gradlew clean build
Helpful scripts
We provide a couple of helpful scripts to build the project.
To build the project in parallel (by default, it uses four cores, but you can change it), run the following command:
./scripts/parallelBuild.sh
To use eight 8 cores, run the following command:
CORES=8 ./scripts/parallelBuild.sh
To build the project without any integration tests (by default, this uses one core), run the following command:
./scripts/noIntegration.sh
To use eight cores, run the following command:
CORES=8 ./scripts/noIntegration.sh
To generate the documentation (for both the root project and the maven plugin), run the following command:
./scripts/generateDocs.sh