Pact-jvm: Build Gradle -- Plugins

Created on 20 Jun 2017  路  11Comments  路  Source: pact-foundation/pact-jvm

Hi. I am trying out the Pact framework, and I am trying to configure the build.gradle plugins. I am working behind a firewall, so all plugins need to be downloaded to my local maven repo.

Since I am intending to solely be coding in java, are all the sub-modules and plugins necessary? More specifically, the org.jetbrains.kotlin.jvm plugin has been giving me problems, and I am unsure if I would need it at all if I only intend to use java alone.

All 11 comments

Are you trying to build the pact-jvm modules, or your own?

I'm trying to build the pact-jvm modules, and then eventually write my own consumer contract classes and provider classes.

To build the pact-jvm modules, you do need the kotlin plugin. However, pact-jvm jars are published to maven central so you could use those instead.

Thanks. I am a newbie to this contract-testing. So in order to write contract tests and provider j-unit tests. I only need the 'pact-jvm-consumer-junit' and 'pact-jvm-provider-junit' modules from maven central? Are these modules dependent on others in the project?

If possible, could you explain what I would need to do in order to start writing my own consumer and provider tests?

@mcgriffa - I had the same difficulty while starting off - I have pact-jvm-consumer-junit being used for consumer tests but I don't use pact-jvm-provider-junit - but this can give you some idea - https://github.com/shashidesai/pactdemo - this is a sample test project I put together to experiment with pact-jvm - hope this helps to certain extent. It has a readme too.

@shashidesai Thanks so much, your demo is pretty helpful. do you have any tips about the pact-broker. Is there away to publish the pacts to the provider without the broker or is that the best way to do it?

So pact broker can be run locally on your laptop or in your infrastructure whichever you want.
You don't publish pacts to the provider usually, you use broker as a means for bookkeeping versions of pacts which consumer(maybe apps using the api) can publish to and provider (api) can use to validate (run pactVerify step) and both these actions can be part of a CI pipeline (example: jenkins)

Right now we are using our own broker deployed in our AWS environment, you can do similar or use the pact broker provided by Dius at https://pact.dius.com.au/

Hi @shashidesai or @uglyog have you used pact with a maven build before? I'm wondering why my pact file is not being created when I run a maven install. Any tips?

@mcgriffa - sorry, I haven't tried maven. if you can check-in the project somewhere, its easier to look at the way you are trying to do.

@shashidesai thanks so much. I'm looking at examples, and tweaking things, and it's weird a folder where the pact is supposed to go is being created, but the pact isn't in there. I'll keep looking though, thanks!

Was this page helpful?
0 / 5 - 0 ratings