pact-jvm: Since 4.3.16 pact publish configuration can not be found

We updated from 4.3.15 to 4.3.16 and now see this issue You must add a pact publish configuration to your build before you can use the pactPublish task

Altough we have a pact publish configuration and it still works with 4.3.15. We use Gradle 7.5.1

Does may this commit has something to do with it: https://github.com/pact-foundation/pact-jvm/commit/e3dd8bf5d1cdaa263c428cb1e0fdc94196ce6fde?diff=split#diff-84994c4f13669c1feb65cf6db4a09398e94d9fef8d687329926cbd4547cb1370

Since 4.3.16 it seems like our pactPublish in this class is null https://github.com/pact-foundation/pact-jvm/blob/master/provider/gradle/src/main/groovy/au/com/dius/pact/provider/gradle/PactPublishTask.groovy#L41

We don´t use Configuration cache as also Gradle says it is an incubating feature. https://docs.gradle.org/current/userguide/configuration_cache.html

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 22 (10 by maintainers)

Commits related to this issue

Most upvoted comments

Any updates on this one? I’m also facing that issue with newer versions.

I am experiencing a similar issue to what @eloo posted above. Prior to version 4.3.16 we were using the following configuration:

pactPublish.dependsOn test

With the update to 4.3.16 and on 4.4.x I receive the following error whenever I try to run gradle pactPublish You must add a pact publish configuration to your build before you can use the pactPublish task

Trying on 4.5.0 I see the new error:

A problem was found with the configuration of task ':pactPublish' (type 'PactPublishTask').
  - In plugin 'au.com.dius.pact' type 'au.com.dius.pact.provider.gradle.PactPublishTask' property 'pactPublish' doesn't have a configured value.
    
    Reason: This property isn't marked as optional and no value has been configured.
    
    Possible solutions:
      1. Assign a value to 'pactPublish'.
      2. Mark property 'pactPublish' as optional.
    
    Please refer to https://docs.gradle.org/7.5.1/userguide/validation_problems.html#value_not_set for more details about this problem.

I tried using the workaround mentioned above, like so, but I still get the same error.

pactPublish {
    dependsOn test
    pactPublish = project.pact.publish
}

Is there a different way to specify a dependency that should be used in place of this? Prior to 4.3.16 it was all working as expected.

Appending this to the previous example is a strange/buggy but working workaround:

pactPublish {
    pactPublish = project.pact.publish
}