// tag::repos[] /* We need to use the [buildscript {}] section when we have to modify the classpath for the plugins. If that's not the case this section can be skipped. If you don't need to modify the classpath (e.g. add a Pact dependency), then you can just set the [pluginManagement {}] section in [settings.gradle] file. // settings.gradle pluginManagement { repositories { // for snapshots maven {url "https://repo.spring.io/snapshot"} // for milestones maven {url "https://repo.spring.io/milestone"} // for GA versions gradlePluginPortal() } } */ buildscript { repositories { mavenCentral() mavenLocal() maven { url "https://repo.spring.io/snapshot" } maven { url "https://repo.spring.io/milestone" } maven { url "https://repo.spring.io/release" } } // end::repos[] dependencies { classpath "org.springframework.boot:spring-boot-gradle-plugin:${findProperty('bootVersion') ?: bootVersion}" classpath "org.springframework.cloud:spring-cloud-contract-gradle-plugin:${findProperty('verifierVersion') ?: verifierVersion}" //tag::pact_dependency[] // if additional dependencies are needed e.g. for Pact classpath "org.springframework.cloud:spring-cloud-contract-pact:${findProperty('verifierVersion') ?: verifierVersion}" //end::pact_dependency[] } } group = 'com.example' version = '0.0.1' // tag::deps_repos[] repositories { mavenCentral() mavenLocal() maven { url "https://repo.spring.io/snapshot" } maven { url "https://repo.spring.io/milestone" } maven { url "https://repo.spring.io/release" } } // end::deps_repos[] apply plugin: 'java' apply plugin: 'org.springframework.boot' apply plugin: 'io.spring.dependency-management' apply plugin: 'spring-cloud-contract' apply plugin: 'maven-publish' dependencyManagement { imports { mavenBom "org.springframework.cloud:spring-cloud-dependencies:$BOM_VERSION" } } contracts { packageWithBaseClasses = 'com.example.fraud' // convertToYaml = true } dependencies { compile("org.springframework.boot:spring-boot-starter-web") compile("org.springframework.boot:spring-boot-starter-actuator") compile("org.springframework.cloud:spring-cloud-starter-stream-rabbit") testCompile 'org.springframework.cloud:spring-cloud-starter-contract-verifier' testCompile "org.springframework.cloud:spring-cloud-stream-test-support" } test { systemProperty 'spring.profiles.active', 'gradle' testLogging { exceptionFormat = 'full' } afterSuite { desc, result -> if (!desc.parent) { println "Results: (${result.testCount} tests, ${result.successfulTestCount} successes, ${result.failedTestCount} failures, ${result.skippedTestCount} skipped)" if (result.testCount == 0) { throw new IllegalStateException("No tests were found. Failing the build") } } } } clean.doFirst { delete "~/.m2/repository/com/example/http-server-dsl-gradle" } task resolveDependencies { doLast { project.rootProject.allprojects.each { subProject -> subProject.buildscript.configurations.each { configuration -> configuration.resolve() } subProject.configurations.each { configuration -> configuration.resolve() } } } }