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 480 forks source link

upgrade to "org.apache.groovy:groovy" #1529

Closed octopus-prime closed 2 years ago

octopus-prime commented 2 years ago

In a common project you want to use pact-tests and rest-assured-tests. So you have this in your build.gradle

    testImplementation group: 'au.com.dius.pact.provider', name: 'junit5', version: '4.4.0-beta.0'
    testImplementation group: 'io.rest-assured', name: 'rest-assured', version: '5.0.0'
    testImplementation group: 'io.rest-assured', name: 'json-path', version: '5.0.0'
    testImplementation group: 'io.rest-assured', name: 'xml-path', version: '5.0.0'

But then you get these errors

Execution failed for task ':test'.
> Could not resolve all files for configuration ':testRuntimeClasspath'.
   > Could not resolve org.apache.groovy:groovy:4.0.1.
     Required by:
         project : > io.rest-assured:rest-assured:5.0.0
         project : > io.rest-assured:json-path:5.0.0
         project : > io.rest-assured:xml-path:5.0.0
         project : > io.rest-assured:rest-assured:5.0.0 > org.apache.groovy:groovy-xml:4.0.1
         project : > io.rest-assured:json-path:5.0.0 > org.apache.groovy:groovy-json:4.0.1
         project : > io.rest-assured:json-path:5.0.0 > io.rest-assured:rest-assured-common:5.0.0
         project : > io.rest-assured:rest-assured:5.0.0 > org.apache.groovy:groovy-xml:4.0.1 > org.apache.groovy:groovy-bom:4.0.1
      > Module 'org.apache.groovy:groovy' has been rejected:
           Cannot select module with conflict on capability 'org.codehaus.groovy:groovy:4.0.1' also provided by [org.codehaus.groovy:groovy:3.0.8(runtime)]
   > Could not resolve org.codehaus.groovy:groovy:3.0.8.
     Required by:
         project : > au.com.dius.pact.provider:junit5:4.4.0-beta.0 > au.com.dius.pact:provider:4.4.0-beta.0
      > Module 'org.codehaus.groovy:groovy' has been rejected:
           Cannot select module with conflict on capability 'org.codehaus.groovy:groovy:3.0.8' also provided by [org.apache.groovy:groovy:4.0.1(groovyRuntimeElements)]

Then you could try

    testImplementation(group: 'au.com.dius.pact.provider', name: 'junit5', version: '4.4.0-beta.0') {
        exclude group: 'org.codehaus.groovy', module: 'groovy'
    }

But upgrading to "org.apache.groovy:groovy" might be the better out-of-the-box solution...

See https://groovy-lang.org/releasenotes/groovy-4.0.html

In Groovy 4.0, the groupId of the maven coordinates for Groovy have changed from org.codehaus.groovy to org.apache.groovy. Please update your Gradle/Maven/other build settings appropriately.

octopus-prime commented 2 years ago

Thanks! Works fine with 4.4.0-beta.1