Git ignores the build directory of the Spring-Consumer
[demos/example-siren] / provider / build.gradle
index 6e73ef7..b5e461b 100644 (file)
@@ -2,23 +2,56 @@ plugins {
        id 'org.springframework.boot' version '2.3.4.RELEASE'
        id 'io.spring.dependency-management' version '1.0.10.RELEASE'
        id 'java'
+       id "io.freefair.lombok" version "5.2.1"
+       id "au.com.dius.pact" version "4.2.2"
+       id "com.wiredforcode.spawn" version "0.8.2"
 }
 
 group = 'io.pactflow.example'
-version = '0.0.1-SNAPSHOT'
+version = '0.0.1'
 sourceCompatibility = '11'
 
 repositories {
+       mavenLocal()
        mavenCentral()
 }
 
 dependencies {
-       implementation 'org.springframework.boot:spring-boot-starter'
+       implementation 'org.springframework.boot:spring-boot-starter-hateoas'
+       implementation 'com.jayway.jsonpath:json-path'
+       implementation 'de.ingogriebsch.hateoas:spring-hateoas-siren:1.0.0'
+
        testImplementation('org.springframework.boot:spring-boot-starter-test') {
                exclude group: 'org.junit.vintage', module: 'junit-vintage-engine'
        }
+       testImplementation 'au.com.dius.pact.provider:junit5spring:4.2.2'
 }
 
 test {
        useJUnitPlatform()
 }
+
+task startServer(type: SpawnProcessTask, dependsOn: 'assemble') {
+       command "java -jar ${projectDir}/build/libs/siren-provider-0.0.1.jar"
+       ready 'Started SirenProviderApplication'
+}
+
+task stopServer(type: KillProcessTask)
+
+pact {
+       serviceProviders {
+               "Siren Order Provider" {
+
+                       startProviderTask = startServer
+                       terminateProviderTask = stopServer
+
+                       hasPactWith("Siren Consumer") {
+                               pactSource = file("${projectDir}/../consumer/pacts/Siren Order Provider-Siren Order Service.json")
+                       }
+
+                       hasPactWith("Spring Consumer") {
+                               pactSource = file("${projectDir}/../spring-consumer/target/pacts/SpringConsumer-SirenOrderProvider.json")
+                       }
+               }
+       }
+}