<repositories>
<repository>
@@ -1466,10 +1451,8 @@ all the contract are present in the producer’s repository
</pluginRepositories>
diff --git a/spring-cloud-contract.html b/spring-cloud-contract.html index aa55e056fd..de6a9798d3 100644 --- a/spring-cloud-contract.html +++ b/spring-cloud-contract.html @@ -416,6 +416,14 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b .hide-for-print{display:none!important} .show-for-print{display:inherit!important}} + + + +
If using the SNAPSHOT / Milestone / Release Candidate versions please add the following section to your
Maven POM
-<repositories>
<repository>
@@ -1466,10 +1451,8 @@ all the contract are present in the producer’s repository
</pluginRepositories>
Gradle build
-repositories {
mavenCentral()
@@ -2074,42 +2057,6 @@ example of achieving the same by changing the properties.
is under constant development.
Marcin Grzejszczak and Jakub Kubryński talking about Spring Cloud Contract Verifier
-Olga Maciaszek-Sharma talking about Accurest (Spring Cloud Contract Verifier predecessor)
-Marcin Grzejszczak and Jakub Kubryński talking about Accurest (Spring Cloud Contract Verifier predecessor)
-For more information please consult the Stub Runner Messaging sections.
Example of Spring Cloud Contract Verifier Gradle setup:
+<dependencies>
+ <dependency>
+ <groupId>org.springframework.cloud</groupId>
+ <artifactId>spring-cloud-starter-stream-rabbit</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.springframework.cloud</groupId>
+ <artifactId>spring-cloud-starter-contract-stub-runner</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework.cloud</groupId>
+ <artifactId>spring-cloud-stream-test-support</artifactId>
+ <scope>test</scope>
+ </dependency>
+</dependencies>
+
+<dependencyManagement>
+ <dependencies>
+ <dependency>
+ <groupId>org.springframework.cloud</groupId>
+ <artifactId>spring-cloud-dependencies</artifactId>
+ <version>Camden.BUILD-SNAPSHOT</version>
+ <type>pom</type>
+ <scope>import</scope>
+ </dependency>
+ </dependencies>
+</dependencyManagement>
ext {
contractsDir = file("mappings")
@@ -4035,13 +4012,6 @@ publishing {
Example of Maven can be found in the Stream Sink sample
-Add the additional snapshot repository to your build.gradle to use snapshot versions which are automatically uploaded after every successful build:
buildscript {
- repositories {
- mavenCentral()
- mavenLocal()
- maven { url "http://repo.spring.io/snapshot" }
- maven { url "http://repo.spring.io/milestone" }
- maven { url "http://repo.spring.io/release" }
- }
-}
-for Maven
-<repositories>
<repository>
@@ -4133,18 +4088,109 @@ automatically for you.
</pluginRepositories>
buildscript {
+ repositories {
+ mavenCentral()
+ mavenLocal()
+ maven { url "http://repo.spring.io/snapshot" }
+ maven { url "http://repo.spring.io/milestone" }
+ maven { url "http://repo.spring.io/release" }
+ }
+The easiest approach would be to centralize the way stubs are kept. For example you can keep them as JARs in a Maven repository.
Example of Spring Cloud Contract Verifier Gradle setup:
+|
+ Tip
+ |
++For both Maven and Gradle the setup comes out of the box. But you can customize it if you want to. + | +
<!-- First disable the default jar setup in the properties section-->
+<!-- we don't want the verifier to do a jar for us -->
+<spring.cloud.contract.verifier.skip>true</spring.cloud.contract.verifier.skip>
+
+<!-- Next add the assembly plugin to your build -->
+<plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-assembly-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>stub</id>
+ <phase>prepare-package</phase>
+ <goals>
+ <goal>single</goal>
+ </goals>
+ <inherited>false</inherited>
+ <configuration>
+ <attach>true</attach>
+ <descriptor>${basedir}/src/assembly/stub.xml</descriptor>
+ </configuration>
+ </execution>
+ </executions>
+</plugin>
+
+<!-- Finally setup your assembly. Below you can find the contents of src/main/assembly/stub.xml -->
+<assembly
+ xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.3"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.3 http://maven.apache.org/xsd/assembly-1.1.3.xsd">
+ <id>stubs</id>
+ <formats>
+ <format>jar</format>
+ </formats>
+ <includeBaseDirectory>false</includeBaseDirectory>
+ <fileSets>
+ <fileSet>
+ <directory>src/main/java</directory>
+ <outputDirectory>/</outputDirectory>
+ <includes>
+ <include>**com/example/model/*.*</include>
+ </includes>
+ </fileSet>
+ <fileSet>
+ <directory>${project.build.directory}/classes</directory>
+ <outputDirectory>/</outputDirectory>
+ <includes>
+ <include>**com/example/model/*.*</include>
+ </includes>
+ </fileSet>
+ <fileSet>
+ <directory>${project.build.directory}/snippets/stubs</directory>
+ <outputDirectory>META-INF/${project.groupId}/${project.artifactId}/${project.version}/mappings</outputDirectory>
+ <includes>
+ <include>**/*</include>
+ </includes>
+ </fileSet>
+ <fileSet>
+ <directory>${basedir}/src/test/resources/contracts</directory>
+ <outputDirectory>META-INF/${project.groupId}/${project.artifactId}/${project.version}/contracts</outputDirectory>
+ <includes>
+ <include>**/*.groovy</include>
+ </includes>
+ </fileSet>
+ </fileSets>
+</assembly>
+ext {
contractsDir = file("mappings")
@@ -4167,13 +4213,6 @@ publishing {
Example of Maven can be found in the Spring Cloud Contract Verifier README
-value(consumer(...), producer(...))
+value(c(...), p(...))
value(stub(...), test(...))
value(client(...), server(...))
$(consumer(...), producer(...))
+$(c(...), p(...))
$(stub(...), test(...))
$(client(...), server(...))
<dependency>
<groupId>com.example</groupId>
@@ -6925,13 +6965,10 @@ common jar classes will be visible in your Groovy files.
</dependency>
testCompile("com.example:beer-common:0.0.1-SNAPSHOT")
-testCompile("com.example:beer-common:0.0.1-SNAPSHOT")
Now you have to add the dependency for the plugin to reuse at runtime.
<plugin>
<groupId>org.springframework.cloud</groupId>
@@ -6968,20 +7004,10 @@ common jar classes will be visible in your Groovy files.
</plugin>
Inside your buildscript {} section pass the following:
dependencies {
- classpath "org.springframework.boot:spring-boot-gradle-plugin:1.4.1.RELEASE"
- classpath "org.springframework.cloud:spring-cloud-contract-gradle-plugin:${findProperty('verifierVersion') ?: verifierVersion}"
- classpath "com.example:beer-common:0.0.1-SNAPSHOT"
-}
-classpath "com.example:beer-common:0.0.1-SNAPSHOT"