- In build.sbt, import the plugin
import au.com.dius.pact.provider.sbt._ SbtProviderPlugin.config ++ Seq( providers := Seq( ProviderConfig(name = "Provider", port=49600, requestFilter = Some(request => request.addHeader("Authorization", "Bearer NTY5YjQwNGQtYjFkMi00N2UyLThiODgtYzQzNzBkNzlkMDQ5") )).hasPactWith(ConsumerConfig(name = "TestConsumer", pactFile = file("spec/pacts/test-consumer.json"))) ) )
2. In a Makefile, have the following task:
run-provider: make run-app & \ sleep 60 sbt pactVerify
Where run-app is another Makefile task to spin up the app:
./activator "project test-server" ~run
We spin up the project, and then & will put it running in the background. We wait for 60 seconds for the project to be up. Finally we run Pact Provider.