@@ -323,9 +323,7 @@ dependencies {
323323
324324 contractTestImplementation group : ' org.apache.httpcomponents' , name : ' httpclient' , version : versions. httpComponents
325325 contractTestImplementation group : ' au.com.dius.pact.consumer' , name : ' junit5' , version : versions. pact_version
326- contractTestImplementation group : ' au.com.dius.pact.consumer' , name : ' java8' , version : versions. pact_version
327326 contractTestRuntime group : ' au.com.dius.pact.consumer' , name : ' junit5' , version : versions. pact_version
328- contractTestRuntime group : ' au.com.dius.pact.consumer' , name : ' java8' , version : versions. pact_version
329327
330328 contractTestImplementation group : ' org.springframework.boot' , name : ' spring-boot-starter-test'
331329 contractTestImplementation(" org.junit.jupiter:junit-jupiter-api:5.10.2" )
@@ -564,30 +562,29 @@ run {
564562 }
565563}
566564
565+
567566project. ext {
568567 pactVersion = getCheckedOutGitCommitHash()
569568}
570569
570+ pact {
571+ publish {
572+ pactDirectory = ' pacts'
573+ pactBrokerUrl = System . getenv(" PACT_BROKER_FULL_URL" ) ?: ' http://localhost:80'
574+ tags = [System . getenv(" PACT_BRANCH_NAME" ) ?: ' Dev' ]
575+ version = project. pactVersion
576+ }
577+ }
578+
571579task runAndPublishConsumerPactTests (type : Test ){
580+ dependsOn(contract)
572581 logger. lifecycle(" Runs pact Tests" )
573582 testClassesDirs = sourceSets. contractTest. output. classesDirs
574583 classpath = sourceSets. contractTest. runtimeClasspath
575-
584+ finalizedBy(pactPublish)
576585}
577586
578- runAndPublishConsumerPactTests. dependsOn contract
579-
580- runAndPublishConsumerPactTests. finalizedBy pactPublish
581-
582587def getCheckedOutGitCommitHash () {
583588 ' git rev-parse --verify --short HEAD' . execute(). text. trim()
584589}
585590
586- pact {
587- publish {
588- pactDirectory = ' pacts'
589- pactBrokerUrl = System . getenv(" PACT_BROKER_FULL_URL" ) ?: ' http://localhost:80'
590- tags = [System . getenv(" PACT_BRANCH_NAME" ) ?: ' Dev' ]
591- version = project. pactVersion
592- }
593- }
0 commit comments