Files
spring-cloud-contract/samples/standalone/dsl/http-server/build.gradle
2022-12-01 13:18:08 +01:00

99 lines
2.5 KiB
Groovy

plugins {
id "java"
id "org.springframework.boot"
id "io.spring.dependency-management"
id "org.springframework.cloud.contract"
id "maven-publish"
}
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[]
ext.set("rest-assured.version", "5.2.1") // TODO: Remove once upgraded in Boot
dependencyManagement {
imports {
mavenBom "org.springframework.cloud:spring-cloud-dependencies:$BOM_VERSION"
}
}
contracts {
packageWithBaseClasses = 'com.example.fraud'
// convertToYaml = true
contractsDslDir = file("src/test/resources/contracts")
}
dependencies {
implementation("org.springframework.boot:spring-boot-starter-web")
implementation("org.springframework.boot:spring-boot-starter-actuator")
implementation("org.springframework.cloud:spring-cloud-starter-stream-rabbit")
testImplementation 'org.springframework.cloud:spring-cloud-starter-contract-verifier'
testImplementation(group: 'org.springframework.cloud', name: 'spring-cloud-stream-test-binder')
testImplementation('org.springframework.boot:spring-boot-starter-test') {
exclude(group: 'org.junit.vintage', module: 'junit-vintage-engine')
}
}
contractTest {
useJUnitPlatform()
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")
}
}
}
}
publishing {
publications {
maven(MavenPublication) {
artifact bootJar
artifact verifierStubsJar
// https://github.com/spring-gradle-plugins/dependency-management-plugin/issues/273
versionMapping {
usage("java-api") {
fromResolutionOf("runtimeClasspath")
}
usage("java-runtime") {
fromResolutionResult()
}
}
}
}
}
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()
}
}
}
}