Added Gradle / Maven tabs

with these changes if someone is not interested with one of those tools one won't see it until it gets clicked

fixes #152
This commit is contained in:
Marcin Grzejszczak
2016-11-21 13:59:42 +01:00
parent 49373eb160
commit 699c7d2121
18 changed files with 308 additions and 93 deletions

View File

@@ -1,5 +1,3 @@
:samples_url: https://raw.githubusercontent.com/spring-cloud-samples/spring-cloud-contract-samples/master
=== Contract DSL
IMPORTANT: Remember that inside the contract file you have to provide the fully qualified name to
@@ -113,6 +111,8 @@ include::{verifier_core_path}/src/test/groovy/org/springframework/cloud/contract
//include::{verifier_core_path}/src/test/groovy/org/springframework/cloud/contract/verifier/builder/ContractHttpDocsSpec.groovy[tags=bodyAsXml,indent=0]
//----
==== Response
Minimal response must contain **HTTP status code**.
@@ -135,6 +135,7 @@ either via the `value` method
[source,groovy,indent=0]
----
value(consumer(...), producer(...))
value(c(...), p(...))
value(stub(...), test(...))
value(client(...), server(...))
----
@@ -144,6 +145,7 @@ or if you're using the Groovy map notation for body you can use the `$()` method
[source,groovy,indent=0]
----
$(consumer(...), producer(...))
$(c(...), p(...))
$(stub(...), test(...))
$(client(...), server(...))
----
@@ -364,16 +366,14 @@ First add the common jar dependency as a test dependency. That way since your
contracts files are available at test resources path, automatically the
common jar classes will be visible in your Groovy files.
====== Adding test dependency in Maven
[source,xml]
[source,xml,indent=0,subs="verbatim,attributes",role="primary"]
.Maven
----
include::{samples_url}/producer/pom.xml[tags=test_dep,indent=0]
----
====== Adding test dependency in Gradle
[source,xml]
[source,groovy,indent=0,subs="verbatim,attributes",role="secondary"]
.Gradle
----
include::{samples_url}/producer/build.gradle[tags=test_dep,indent=0]
----
@@ -382,18 +382,14 @@ include::{samples_url}/producer/build.gradle[tags=test_dep,indent=0]
Now you have to add the dependency for the plugin to reuse at runtime.
====== Adding test plugin dependency in Maven
[source,xml]
[source,xml,indent=0,subs="verbatim,attributes",role="primary"]
.Maven
----
include::{samples_url}/producer/pom.xml[tags=test_dep_in_plugin,indent=0]
----
====== Adding test plugin dependency in Gradle
Inside your `buildscript { dependencies {} }` section pass the following:
[source,groovy]
[source,groovy,indent=0,subs="verbatim,attributes",role="secondary"]
.Gradle
----
include::{samples_url}/producer/build.gradle[tags=test_dep_in_plugin,indent=0]
----

View File

@@ -135,16 +135,14 @@ all the contract are present in the producer's repository
If using the *SNAPSHOT* / *Milestone* / *Release Candidate* versions please add the following section to your
Maven POM
[source,xml,indent=0]
[source,xml,indent=0,subs="verbatim,attributes",role="primary"]
.Maven
----
include::{introduction_url}/samples/standalone/dsl/http-server/pom.xml[tags=repos,indent=0]
----
Gradle build
[source,groovy,indent=0]
[source,groovy,indent=0,subs="verbatim,attributes",role="secondary"]
.Gradle
----
include::{introduction_url}/samples/standalone/dsl/http-server/build.gradle[tags=deps_repos,indent=0]
----
@@ -468,26 +466,6 @@ Spring Cloud Contract Verifier and Stub Runner are using the following libraries
Below you can find some resources related to Spring Cloud Contract Verifier and Stub Runner. Note that some can be outdated since the Spring Cloud Contract Verifier project
is under constant development.
===== Videos
*Marcin Grzejszczak and Jakub Kubryński talking about Spring Cloud Contract Verifier*
video::msRFcQM07-Y[youtube]
https://www.youtube.com/watch?v=msRFcQM07-Y[click here to see the video]
*Olga Maciaszek-Sharma talking about Accurest (Spring Cloud Contract Verifier predecessor)*
video::daafmTYFoDU[youtube]
https://www.youtube.com/watch?v=daafmTYFoDU[click here to see the video]
*Marcin Grzejszczak and Jakub Kubryński talking about Accurest (Spring Cloud Contract Verifier predecessor)*
video::130779882[vimeo]
https://vimeo.com/130779882[click here to see the video]
===== Readings
- http://www.slideshare.net/MarcinGrzejszczak/stick-to-the-rules-consumer-driven-contracts-201507-confitura[Slides from Marcin Grzejszczak's talk about Accurest]

View File

@@ -132,15 +132,14 @@ and proper stubbed routes are created.
For more information please consult the Stub Runner Messaging sections.
===== Gradle Setup
[source,xml,indent=0,subs="verbatim,attributes",role="primary"]
.Maven
----
include::{standalone_messaging_samples_path}/stream-sink/pom.xml[tags=jars,indent=0]
----
Example of Spring Cloud Contract Verifier Gradle setup:
[source,groovy,indent=0]
[source,groovy,indent=0,subs="verbatim,attributes",role="secondary"]
.Gradle
----
include::{plugins_path}/spring-cloud-contract-gradle-plugin/src/test/resources/functionalTest/scenarioProject/build.gradle[tags=jar_setup,indent=0]
----
===== Maven Setup
Example of Maven can be found in the https://github.com/spring-cloud/spring-cloud-contract/tree/master/samples/standalone/messaging/stream-sink/pom.xml[Stream Sink sample]

View File

@@ -6,7 +6,9 @@
:verifier_core_path: {verifier_root_path}
:stubrunner_core_path: {core_path}/spring-cloud-contract-stub-runner
:standalone_samples_path: {samples_path}/standalone/dsl
:standalone_messaging_samples_path: {samples_path}/standalone/messaging
:tests_path: ../../../../../tests
:samples_url: https://raw.githubusercontent.com/spring-cloud-samples/spring-cloud-contract-samples/master
include::introduction.adoc[]

View File

@@ -12,36 +12,43 @@ automatically for you.
Add the additional snapshot repository to your build.gradle to use snapshot versions which are automatically uploaded after every successful build:
[source,groovy,indent=0]
----
include::{standalone_samples_path}/http-server/build.gradle[tags=repos,indent=0]
}
----
for Maven
[source,xml,indent=0]
[source,xml,indent=0,subs="verbatim,attributes",role="primary"]
.Maven
----
include::{standalone_samples_path}/http-server/pom.xml[tags=repos,indent=0]
----
[source,groovy,indent=0,subs="verbatim,attributes",role="secondary"]
.Gradle
----
include::{standalone_samples_path}/http-server/build.gradle[tags=repos,indent=0]
----
==== Publishing stubs as JARs
The easiest approach would be to centralize the way stubs are kept. For example you can keep them as JARs in a Maven repository.
===== Gradle
TIP: For both Maven and Gradle the setup comes out of the box. But you can customize it if you want to.
Example of Spring Cloud Contract Verifier Gradle setup:
[source,xml,indent=0,subs="verbatim,attributes",role="primary"]
.Maven
----
<!-- First disable the default jar setup in the properties section-->
include::{samples_url}/producer_with_restdocs/pom.xml[tags=skip_jar,indent=0]
[source,groovy,indent=0]
<!-- Next add the assembly plugin to your build -->
include::{samples_url}/producer_with_restdocs/pom.xml[tags=assembly,indent=0]
<!-- Finally setup your assembly. Below you can find the contents of src/main/assembly/stub.xml -->
include::{samples_url}/producer_with_restdocs/src/assembly/stub.xml[indent=0]
----
[source,groovy,indent=0,subs="verbatim,attributes",role="secondary"]
.Gradle
----
include::{plugins_path}/spring-cloud-contract-gradle-plugin/src/test/resources/functionalTest/scenarioProject/build.gradle[tags=jar_setup,indent=0]
----
===== Maven
Example of Maven can be found in the https://github.com/spring-cloud/spring-cloud-contract/[Spring Cloud Contract Verifier README]
==== Modules
include::{stubrunner_core_path}/README.adoc[]