From 0cb5776fc8df28f358c9c4cc6dee497331072d78 Mon Sep 17 00:00:00 2001 From: Olga Maciaszek-Sharma Date: Tue, 11 Sep 2018 14:32:43 +0200 Subject: [PATCH] Add info on generating and running Spock contract tests with Maven. --- docs/src/main/asciidoc/verifier_setup.adoc | 24 ++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/docs/src/main/asciidoc/verifier_setup.adoc b/docs/src/main/asciidoc/verifier_setup.adoc index d755b539ee..ef7f7ce63d 100644 --- a/docs/src/main/asciidoc/verifier_setup.adoc +++ b/docs/src/main/asciidoc/verifier_setup.adoc @@ -897,6 +897,30 @@ In order to fix this issue, provide the following section in your `pom.xml`: ---- +==== Maven Plugin with Spock Tests + +You can select the http://spockframework.org/[Spock Framework] for creating and executing the auto-generated contract +verification tests with both Maven and Gradle plugin. However, whereas with Gradle its really straightforward, +in Maven you will require some additional setup in order to make the tests compile and execute properly. + +First of all, you will have to use a plugin, such as https://github.com/groovy/GMavenPlus[GMavenPlus] plugin, +to add Groovy to your project. In GMavenPlus plugin, you will need to explicitly set test sources, including both the +path where your base test classes are defined and the path were the generated contract tests are added. +Please refer to the example below: + +[source,xml,indent=0] +---- +include::{samples_url}/producer_with_spock/pom.xml[tags=gmavenplus-setup,indent=0] +---- + +If you uphold to the Spock convention of ending the test class names with `Spec`, you will also need to adjust your Maven +Surefire plugin setup, like in the following example: + +[source,xml,indent=0] +---- +include::{samples_url}/producer_with_spock/pom.xml[tags=pock-surefire-setup,indent=0] +---- + === Stubs and Transitive Dependencies The Maven and Gradle plugin that add the tasks that create the stubs jar for you. One