pact-foundation / pact-jvm

JVM version of Pact. Enables consumer driven contract testing, providing a mock service and DSL for the consumer project, and interaction playback and verification for the service provider project.
https://docs.pact.io
Apache License 2.0
1.08k stars 479 forks source link

plugin version higher than 4.3.19 throws exception #1686

Closed wmunyan closed 4 months ago

wmunyan commented 1 year ago

I am using gradle with the following plugins section:

plugins {
   ...
   id "au.com.dius.pact" version "4.3.19"

and some test dependencies:

testImplementation group: 'au.com.dius.pact', name: 'consumer', version: '4.3.19'
testImplementation group: 'au.com.dius.pact', name: 'provider', version: '4.3.19'

testImplementation 'au.com.dius:pact-jvm-provider-gradle:4.0.10'
testImplementation 'au.com.dius:pact-jvm-consumer-junit:4.0.10'

However, if I try to use any version higher than 4.3.19, executing any gradle tasks fails with the following error:

Cannot invoke "org.gradle.api.artifacts.VersionConstraint.getRequiredVersion()" because "cst" is null

It looks as though I am using gradle 7.4.2, if that helps. Thanks for any help!

rholshausen commented 1 year ago

Don't mix major Pact-JVM versions. You're using both 4.3.19 and 4.0.10.

wmunyan commented 1 year ago

The highest available version of au.com.dius:pact-jvm-consumer-junit is 4.0.10 per https://mvnrepository.com/artifact/au.com.dius/pact-jvm-consumer-junit

The highest available version of au.com.dius:pact-jvm-provider-gradle is 4.0.10 per https://mvnrepository.com/artifact/au.com.dius/pact-jvm-provider-gradle

rholshausen commented 1 year ago

Use au.com.dius.pact.consumer:junit:4.3.19 and au.com.dius.pact.provider:gradle:4.3.19

ealesjordan commented 1 year ago

I get the same issue when I have no pact dependencies added in.

Attempting with gradle plugin version 4.6.1 and gradle version 7.4.2.


However, if I roll back the pact gradle plugin and add the latest dependencies like this:

plugins {
    ...
    id 'au.com.dius.pact' version '4.3.12'
}

And try to include these dependencies:

{
    ...
    testImplementation 'au.com.dius.pact.provider:junit5spring:4.6.1'
    testImplementation 'au.com.dius.pact.consumer:junit5:4.6.1'
}

I get this exception for both of the dependencies:

 Cannot invoke "org.gradle.api.artifacts.VersionConstraint.getRequiredVersion()" because "cst" is null

The same thing happens if I use the gradle plugin version of 4.6.1 to match up with the dependency version.


The only way I can get it to work is rollback the plugin and the dependencies to 4.3.19 (4.4.0 has the same issues)

rholshausen commented 1 year ago

These must be the same: image