I am working to setup wiremock for springboot rest api and using rest assured and spring-cloud-starter-contract-stub-runner from spring cloud. when i run the sample integration test i encounter module conflict error
Conflicting module versions. Module [groovy-xml is loaded in version 4.x.x and you are trying to load version 3.x.x
Asked Answered
Found this workaround on Rest Assured's GitHub page. You replace Rest Assured's dependency with this one
<dependency>
<groupId>io.rest-assured</groupId>
<artifactId>rest-assured</artifactId>
<version>5.1.1</version>
<scope>test</scope>
<exclusions><!-- https://www.baeldung.com/maven-version-collision -->
<exclusion>
<groupId>org.apache.groovy</groupId>
<artifactId>groovy</artifactId>
</exclusion>
<exclusion>
<groupId>org.apache.groovy</groupId>
<artifactId>groovy-xml</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>io.rest-assured</groupId>
<artifactId>json-schema-validator</artifactId>
<version>5.1.1</version>
<scope>test</scope>
</dependency>
- check your dependency tree of pom file. The reason for the error is there were two groovy libs in your class path with different versions and this is causing the conflict
- One from rest-assured dependency and other from spring-cloud-starter-contract-stub-runner dependency
- Solution is to remove rest assured and replace it with restdocs-api-spec-restassured dependency. This way you can use rest assured with out additional groovy dependency . your class path will only have 1 groovy from spring-cloud-starter-contract-stub-runner dependency
groovy.lang.GroovyRuntimeException: Conflicting module versions. Module [groovy-xml is loaded in version 4.0.6 and you are trying to load version 3.0.19
implementation ("io.rest-assured:rest-assured") {
exclude group: "org.apache.groovy", module: "groovy"
exclude group: "org.apache.groovy", module: "groovy-xml"
}
<dependency>
<groupId>io.rest-assured</groupId>
<artifactId>rest-assured</artifactId>
<version>${restassured.version}</version>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy</artifactId>
</exclusion>
<exclusion>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy-xml</artifactId>
</exclusion>
</exclusions>
</dependency>
1 just manually remove rest-assured dependency from POM file.
2 add to the pom file
<dependency>
<groupId>com.epages</groupId>
<artifactId>restdocs-api-spec-restassured</artifactId>
<version>0.10.4</version>
</dependency>
3 Maven clean
4 Maven Compile
5 Maven - Reload(refresh)
Gradle dependencies:
testImplementation('io.rest-assured:rest-assured:5.3.0') {
exclude group: 'org.apache.groovy', module: 'groovy'
exclude group: 'org.apache.groovy', module: 'groovy-xml'
}
Remove the groovy related dependencies and try to run your project, hopefully it will solve the problem. Make sure that you are using the latest version of rest-assure i.e 5.1.1 or later on
- Remove lower version of dependency
- Add below version to pom.xml file
Rest Assured version 5.3.0
© 2022 - 2025 — McMap. All rights reserved.