3

I was able to generate a pact file and then verify it using the maven plugin. Now, I am trying to publish the pacts using a pact broker.

What I have done so far is based on the below link- https://github.com/DiUS/pact-jvm/tree/master/pact-jvm-provider-maven#publishing-pact-files-to-a-pact-broker-version-320

<plugin>
 <groupId>au.com.dius</groupId>
 <artifactId>pact-jvm-provider-maven_2.11</artifactId>
 <version>3.5.5</version>
 <configuration>
   <pactDirectory>target/pacts</pactDirectory> <!-- Defaults to ${project.build.directory}/pacts -->
   <pactBrokerUrl>http://<localIP>:80</pactBrokerUrl>
   <projectVersion>1.0.100</projectVersion> <!-- Defaults to ${project.version} -->
   <trimSnapshot>true</trimSnapshot> <!-- Defaults to false -->
</configuration>
</plugin>

The question I have here is how do I generate the pactBrokerUrl? Does this involve using the dockerized image of the pact broker as stated here? https://github.com/DiUS/pact_broker-docker Or can I just use the Pact Broker Maven plugin by warmuuh?

ljs
  • 495
  • 1
  • 8
  • 23

2 Answers2

2

you need to install the pact broker in a container as explained in the link in your question. the URL is the IP where the broker is installed. Also you need to use the maven plugin to callout your broker url.

  • Its working now, I can see the pacts :) Both the publish and verify tasks in the maven plugin are running successfully. Is that it? Do I need to also do what is said in this section? https://github.com/DiUS/pact-jvm/tree/master/pact-jvm-provider-maven#verifying-pact-files-from-a-pact-broker-version-311231 – ljs Oct 01 '17 at 21:25
  • If your tasks are working, and you're seeing the verification in the broker, then you've probably already done that section? – Timothy Jones Oct 02 '17 at 00:56
  • @TimothyJones : Thats why I am confused.Please see my edited pom file section above. It doesn't have a section or section. – ljs Oct 02 '17 at 03:15
  • 1
    serviceprovider section will be useful when there are multiple consumers for the provider so we can callout each consumer inside of the provider section. stateChange URL section is optional. – sivaganesh sivakumar Oct 03 '17 at 04:36
  • hi, even though the maven verify task( in the provider) runs successfully- the pactbroker webpage (http://localhost:80) always shows the "Last Verified" column as empty. That means the pact is not getting verified at all, right? Please, how can I fix this? – ljs Oct 11 '17 at 01:37
0

PACT Broker required to publish PACT file generated by consumer, I have answered the PACT Broker config info for other question, https://stackoverflow.com/a/62300089/3056361

Kanthishere
  • 173
  • 3
  • 7