Files
spring-cloud-contract/samples/standalone/messaging/stream-source/build.gradle
2019-04-16 08:41:10 +04:00

113 lines
3.1 KiB
Groovy

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" }
}
dependencies {
classpath "org.springframework.boot:spring-boot-gradle-plugin:${findProperty('bootVersion') ?: bootVersion}"
classpath "org.springframework.cloud:spring-cloud-contract-gradle-plugin:${findProperty('verifierVersion') ?: verifierVersion}"
// Example of using Rest Assured 3.x. If you don't add this section Rest Assured 2.9.0 will be used
// classpath "com.jayway.restassured:rest-assured:2.9.0"
// classpath "com.jayway.restassured:spring-mock-mvc:2.9.0"
}
}
group = 'com.example'
version = '0.0.1-SNAPSHOT'
repositories {
mavenCentral()
mavenLocal()
maven { url "https://repo.spring.io/snapshot" }
maven { url "https://repo.spring.io/milestone" }
maven { url "https://repo.spring.io/release" }
}
apply plugin: 'groovy'
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"
}
}
ext {
stubsOutputDirRoot = file("${project.buildDir}/stubs/")
}
contracts {
baseClassMappings {
baseClassMapping('.*', 'com.example.source.SensorSourceTestBase')
}
stubsOutputDir = stubsOutputDirRoot
}
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"
// Example of using Rest Assured 3.x. If you don't add this section Rest Assured 2.9.0 will be used
// testCompile "com.jayway.restassured:rest-assured:2.9.0"
// testCompile "com.jayway.restassured:spring-mock-mvc:2.9.0"
}
task stubsJar(type: Jar, dependsOn: "generateClientStubs") {
baseName = "${project.name}"
classifier = "stubs"
from stubsOutputDirRoot
}
artifacts {
archives stubsJar
}
publishing {
publications {
stubs(MavenPublication) {
artifactId "${project.name}"
artifact stubsJar
}
}
}
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/stream-source-gradle"
}
task resolveDependencies {
doLast {
project.rootProject.allprojects.each { subProject ->
subProject.buildscript.configurations.each { configuration ->
configuration.resolve()
}
subProject.configurations.each { configuration ->
configuration.resolve()
}
}
}
}