<commit_before>= Gradle Project
include::_attributes.adoc[]

To learn how to set up the Gradle project for Spring Cloud Contract Verifier, read the
following sections:

* <<gradle-prerequisites>>
* <<gradle-add-gradle-plugin>>
* <<gradle-and-rest-assured>>
* <<gradle-snapshot-versions>>
* <<gradle-add-stubs>>
* <<gradle-default-setup>>
* <<gradle-configure-plugin>>
* <<gradle-configuration-options>>
* <<gradle-single-base-class>>
* <<gradle-different-base-classes>>
* <<gradle-invoking-generated-tests>>
* <<gradle-pushing-stubs-to-scm>>
* <<gradle-consumer>>

[[gradle-prerequisites]]
== Prerequisites

In order to use Spring Cloud Contract Verifier with WireMock, you must use either a
Gradle or a Maven plugin.

WARNING: If you want to use Spock in your projects, you must separately add the
`spock-core` and `spock-spring` modules. See https://spockframework.github.io/[Spock's
documnetation for more information]

[[gradle-add-gradle-plugin]]
== Add Gradle Plugin with Dependencies

To add a Gradle plugin with dependencies, you can use code similar to the following:

====
[source,groovy,indent=0]
----
buildscript {
	repositories {
		mavenCentral()
	}
	dependencies {
		classpath "org.springframework.boot:spring-boot-gradle-plugin:${springboot_version}"
		classpath "org.springframework.cloud:spring-cloud-contract-gradle-plugin:${verifier_version}"
	}
}

apply plugin: 'groovy'
apply plugin: 'spring-cloud-contract'

dependencyManagement {
	imports {
		mavenBom "org.springframework.cloud:spring-cloud-contract-dependencies:${verifier_version}"
	}
}

dependencies {
	testCompile "org.codehaus.groovy:groovy-all:${groovyVersion}"
	// example with adding Spock core and Spock Spring
	testCompile "org.spockframework:spock-core:${spockVersion}"
	testCompile "org.spockframework:spock-spring:${spockVersion}"
	testCompile 'org.springframework.cloud:spring-cloud-starter-contract-verifier'
}
----
====

[[gradle-and-rest-assured]]
== Gradle and Rest Assured 2.0

By default, Rest Assured 3.x is added to the classpath. However, to use Rest Assured 2.x
you can add it to the plugins classpath, as the following listing shows:

====
[source,groovy,indent=0]
----
buildscript {
	repositories {
		mavenCentral()
	}
	dependencies {
		classpath "org.springframework.boot:spring-boot-gradle-plugin:${springboot_version}"
		classpath "org.springframework.cloud:spring-cloud-contract-gradle-plugin:${verifier_version}"
		classpath "com.jayway.restassured:rest-assured:2.5.0"
		classpath "com.jayway.restassured:spring-mock-mvc:2.5.0"
	}
}

depenendencies {
    // all dependencies
    // you can exclude rest-assured from spring-cloud-contract-verifier
    testCompile "com.jayway.restassured:rest-assured:2.5.0"
    testCompile "com.jayway.restassured:spring-mock-mvc:2.5.0"
}
----
====<commit_msg>Added info about the new plugin portal; fixes gh-1054<commit_after>= Gradle Project
include::_attributes.adoc[]

To learn how to set up the Gradle project for Spring Cloud Contract Verifier, read the
following sections:

* <<gradle-prerequisites>>
* <<gradle-add-gradle-plugin>>
* <<gradle-and-rest-assured>>
* <<gradle-snapshot-versions>>
* <<gradle-add-stubs>>
* <<gradle-default-setup>>
* <<gradle-configure-plugin>>
* <<gradle-configuration-options>>
* <<gradle-single-base-class>>
* <<gradle-different-base-classes>>
* <<gradle-invoking-generated-tests>>
* <<gradle-pushing-stubs-to-scm>>
* <<gradle-consumer>>

[[gradle-prerequisites]]
== Prerequisites

In order to use Spring Cloud Contract Verifier with WireMock, you must use either a
Gradle or a Maven plugin.

WARNING: If you want to use Spock in your projects, you must separately add the
`spock-core` and `spock-spring` modules. See https://spockframework.github.io/[Spock's
documnetation for more information]

[[gradle-add-gradle-plugin]]
== Add Gradle Plugin with Dependencies

To add a Gradle plugin with dependencies, you can use code similar to the following:

====
[source,groovy,indent=0,subs="verbatim,attributes",role="primary"]
.Plugin DSL
----
buildscript {
	repositories {
		mavenCentral()
	}
	dependencies {
		classpath "org.springframework.boot:spring-boot-gradle-plugin:${springboot_version}"
		classpath "org.springframework.cloud:spring-cloud-contract-gradle-plugin:${verifier_version}"
	}
}

apply plugin: 'groovy'
apply plugin: 'spring-cloud-contract'

dependencyManagement {
	imports {
		mavenBom "org.springframework.cloud:spring-cloud-contract-dependencies:${verifier_version}"
	}
}

dependencies {
	testCompile "org.codehaus.groovy:groovy-all:${groovyVersion}"
	// example with adding Spock core and Spock Spring
	testCompile "org.spockframework:spock-core:${spockVersion}"
	testCompile "org.spockframework:spock-spring:${spockVersion}"
	testCompile 'org.springframework.cloud:spring-cloud-starter-contract-verifier'
}
----

[source,groovy,indent=0,subs="verbatim,attributes",role="secondary"]
.Legacy Plugin Application
----
buildscript {
	repositories {
		mavenCentral()
	}
	dependencies {
		classpath "org.springframework.boot:spring-boot-gradle-plugin:${springboot_version}"
	}
}

apply plugin: 'groovy'

plugins {
  id "org.springframework.cloud.contract" version "${GAVerifierVersion}"
}

dependencyManagement {
	imports {
		mavenBom "org.springframework.cloud:spring-cloud-contract-dependencies:${verifier_version}"
	}
}

dependencies {
	testCompile "org.codehaus.groovy:groovy-all:${groovyVersion}"
	// example with adding Spock core and Spock Spring
	testCompile "org.spockframework:spock-core:${spockVersion}"
	testCompile "org.spockframework:spock-spring:${spockVersion}"
	testCompile 'org.springframework.cloud:spring-cloud-starter-contract-verifier'
}
----
====

IMPORTANT: The Plugin DSL option will only work for GA (General Availability) releases (i.e. `2.2.0.RELEASE` etc.).

[[gradle-and-rest-assured]]
== Gradle and Rest Assured 2.0

By default, Rest Assured 3.x is added to the classpath. However, to use Rest Assured 2.x
you can add it to the plugins classpath, as the following listing shows:

====
[source,groovy,indent=0]
----
buildscript {
	repositories {
		mavenCentral()
	}
	dependencies {
		classpath "org.springframework.boot:spring-boot-gradle-plugin:${springboot_version}"
		classpath "org.springframework.cloud:spring-cloud-contract-gradle-plugin:${verifier_version}"
		classpath "com.jayway.restassured:rest-assured:2.5.0"
		classpath "com.jayway.restassured:spring-mock-mvc:2.5.0"
	}
}

depenendencies {
    // all dependencies
    // you can exclude rest-assured from spring-cloud-contract-verifier
    testCompile "com.jayway.restassured:rest-assured:2.5.0"
    testCompile "com.jayway.restassured:spring-mock-mvc:2.5.0"
}
----
====
{'fraction_non_alphanumeric': 0.13632947542462048, 'fraction_numerical': 0.006613557793476627, 'mean_word_length': 5.289224952741021, 'pattern_counts': {'":': 0, '<': 55, '<?xml version=': 0, '>': 55, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3858527', 'n_tokens_mistral': 2290, 'n_tokens_neox': 2114, 'n_words': 465}