Requires kotlin to be explicitly provided; fixes gh-1189

This commit is contained in:
Marcin Grzejszczak
2019-08-30 10:53:53 +02:00
parent 1e69c7b569
commit 609b9e3b7d
4 changed files with 60 additions and 7 deletions

View File

@@ -103,6 +103,63 @@ To get started with writing contracts in Kotlin you would need to start with a (
Just like the with the Java DSL you can put your contracts in any directory of your choice.
The Maven and Gradle plugins will look at the `src/test/resources/contracts` directory by default.
You need to explicitly pass the the `spring-cloud-contract-spec-kotlin` dependency to your project plugin setup.
====
[source,xml,indent=0,subs="verbatim,attributes",role="primary"]
.Maven
----
<plugin>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-contract-maven-plugin</artifactId>
<version>${spring-cloud-contract.version}</version>
<extensions>true</extensions>
<configuration>
<!-- some config -->
</configuration>
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-contract-spec-kotlin</artifactId>
<version>${spring-cloud-contract.version}</version>
</dependency>
</dependencies>
</plugin>
<dependencies>
<!-- Remember to add this for the DSL support in the IDE and on the consumer side -->
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-contract-spec-kotlin</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
----
[source,groovy,indent=0,subs="verbatim,attributes",role="secondary"]
.Gradle
----
buildscript {
repositories {
// ...
}
dependencies {
classpath "org.springframework.cloud:spring-cloud-contract-gradle-plugin:${scContractVersion}"
// remember to add this:
classpath "org.springframework.cloud:spring-cloud-contract-spec-kotlin:${scContractVersion}"
}
}
dependencies {
// ...
// Remember to add this for the DSL support in the IDE and on the consumer side
testImplementation "org.springframework.cloud:spring-cloud-contract-spec-kotlin"
}
----
====
IMPORTANT: Remember that, inside the Kotlin Script file, you have to provide the fully qualified name to the `ContractDSL` class.
Generally you would use its contract function like this: `org.springframework.cloud.contract.spec.ContractDsl.contract { ... }`.
You can also provide an import to the `contract` function (`import org.springframework.cloud.contract.spec.ContractDsl.Companion.contract`) and then call `contract { ... }`.

View File

@@ -841,7 +841,7 @@ set a `metaData` entry in the Pact file with the `sentTo` key equal to the desti
=== Pact Contract
Spring Cloud Contract can read the Pact JSON definition. You can place the file in the
`src/test/resources/contracts` folder. The following example shows such a Pact contract:
`src/test/resources/contracts` folder. Remember to put the `spring-cloud-contract-pact` dependency to your classpath. The following example shows such a Pact contract:
====
[source,javascript,indent=0]

View File

@@ -4,7 +4,7 @@ source common.sh || source scripts/common.sh || echo "No common.sh script found.
set -e
[[ -z "${CORES}" ]] && CORES=1
[[ -z "${CORES}" ]] && CORES=4
echo -e "\n\nRUNNING FAST BUILD (NO INTEGRATION TESTS) WITH [${CORES}] CORES\n\n"
./mvnw clean install -Pdocs,fast -T ${CORES} -Dinvoker.parallelThreads=${CORES}
./mvnw clean install -Pdocs,fast -T ${CORES} -Dinvoker.parallelThreads=${CORES}

View File

@@ -22,10 +22,6 @@
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-contract-spec-groovy</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-contract-spec-kotlin</artifactId>
</dependency>
<dependency>
<groupId>org.spockframework</groupId>
<artifactId>spock-core</artifactId>