diff --git a/docs/src/main/asciidoc/_project-features-wiremock.adoc b/docs/src/main/asciidoc/_project-features-wiremock.adoc index 7a1912a174..2a20669bef 100644 --- a/docs/src/main/asciidoc/_project-features-wiremock.adoc +++ b/docs/src/main/asciidoc/_project-features-wiremock.adoc @@ -36,7 +36,7 @@ The registered WireMock server is reset after each test class, however, if you n If you use `@AutoConfigureWireMock`, it registers WireMock JSON stubs from the file system or classpath (by default, from `file:src/test/resources/mappings`). You can -customize the locations byusing the `stubs` attribute in the annotation, which can be an +customize the locations by using the `stubs` attribute in the annotation, which can be an Ant-style resource pattern or a directory. In the case of a directory, `**/*.json` is appended. The following code shows an example: diff --git a/docs/src/main/asciidoc/howto.adoc b/docs/src/main/asciidoc/howto.adoc index 4f1997e616..befbca9f71 100644 --- a/docs/src/main/asciidoc/howto.adoc +++ b/docs/src/main/asciidoc/howto.adoc @@ -718,6 +718,36 @@ the `publish` task is executed */ publish.dependsOn("publishStubsToScm") ---- + +It is also possible to further customise the `publishStubsToScm` gradle task. In the following example, +the task is customised to pick contracts from a local git repository: + +[source,groovy,indent=0,role="secondary"] +.gradle +---- +publishStubsToScm { + // We want to modify the default set up of the plugin when publish stubs to scm is called + // We want to pick contracts from a Git repository + contractDependency { + stringNotation = "${project.group}:${project.name}:${project.version}" + } + /* + We reuse the contract dependency section to set up the path + to the folder that contains the contract definitions. In our case the + path will be /groupId/artifactId/version/contracts + */ + contractRepository { + repositoryUrl = "git://file://${new File(project.rootDir, "../target")}/contract_empty_git/" + } + // We set the contracts mode to `LOCAL` + contractsMode = "LOCAL" + } +---- + +IMPORTANT:: Starting with `2.3.0.RELEASE` the `customize{}` closure previously used for the +`publishStubsToScm` customization is no longer available. The settings should be applied directly +within the `publishStubsToScm` closure as in the example above. + ==== With such a setup: diff --git a/spring-cloud-contract-tools/spring-cloud-contract-gradle-plugin/src/main/groovy/org/springframework/cloud/contract/verifier/plugin/PublishStubsToScmTask.groovy b/spring-cloud-contract-tools/spring-cloud-contract-gradle-plugin/src/main/groovy/org/springframework/cloud/contract/verifier/plugin/PublishStubsToScmTask.groovy index c53ac1c250..34c6b8bcad 100644 --- a/spring-cloud-contract-tools/spring-cloud-contract-gradle-plugin/src/main/groovy/org/springframework/cloud/contract/verifier/plugin/PublishStubsToScmTask.groovy +++ b/spring-cloud-contract-tools/spring-cloud-contract-gradle-plugin/src/main/groovy/org/springframework/cloud/contract/verifier/plugin/PublishStubsToScmTask.groovy @@ -37,6 +37,10 @@ import org.springframework.cloud.contract.stubrunner.spring.StubRunnerProperties * to the cloned repo with contracts and stubs. Will also * commit the changes and push them to origin. * + * NOTE: starting with 2.3.0.RELEASE the customize{} closure previously used for + * {@link PublishStubsToScmTask} customisation is no longer available. The settings should be applied directly + * within the publishStubsToScm closure as in the example above. + * * @author Marcin Grzejszczak * @author Anatoliy Balakirev * @since 2.0.0