冲突的模块版本。模块[groovy-xml在版本4.xx中加载,您正在尝试加载版本3.xx

发布于 2025-01-26 08:43:25 字数 147 浏览 3 评论 0原文

我正在努力为Springboot Rest API设置WireMock,并使用Spring Cloud的REST保证和Spring-Cloud-Starter-starter-Contract-Contract-stub-runner。当我运行样本集成测试时,我会遇到模块冲突错误

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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(8

分開簡單 2025-02-02 08:43:25

在Rest Assuble的GitHub页面上找到了这种解决方法。您可以用此

<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>

susped recust的github页面

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>

Rest Assured's Github Page

悸初 2025-02-02 08:43:25
  1. 检查您的POM文件的依赖树。错误的原因是,您的班级路径中有两个时髦的液体,这导致冲突是
  2. 由于休息依赖的依赖性而引起的,而另一个则来自Spring-Cloud-starter-starter-starter-contract-contract-contract-stub-runner依赖性
  3. 解决方案是删除REST REST确保并用RESTDOCS-API特殊依赖性替换。这样,您可以放心,没有其他依赖的依赖
    。您的班级路径只会从Spring-Cloud-Starter-Contract-stub-Runner依赖性中有1个凹槽
  1. 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
  2. One from rest-assured dependency and other from spring-cloud-starter-contract-stub-runner dependency
  3. 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
铁憨憨 2025-02-02 08:43:25

groovy.lang.groovyruntimeException:冲突的模块版本。模块[Groovy-XML已加载4.0.6版,您正在尝试加载版本3.0.19

implementation ("io.rest-assured:rest-assured") {
    exclude group: "org.apache.groovy", module: "groovy"
    exclude group: "org.apache.groovy", module: "groovy-xml"
}

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"
}
渡你暖光 2025-02-02 08:43:25
<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>
<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>
叫嚣ゝ 2025-02-02 08:43:25

1只是手动从pom文件中删除了静止的依赖关系。

2添加到POM文件

<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(刷新)

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)

梨涡少年 2025-02-02 08:43:25

Gradle依赖性:

testImplementation('io.rest-assured:rest-assured:5.3.0')  {
    exclude group: 'org.apache.groovy', module: 'groovy'
    exclude group: 'org.apache.groovy', module: 'groovy-xml'
}

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'
}
我喜欢麦丽素 2025-02-02 08:43:25

删除与Groovy相关的依赖项并尝试运行您的项目,希望它可以解决问题。确保您使用的是最新版本的REST-ASURE IE 5.1.1或更高版本

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

如梦 2025-02-02 08:43:25
  1. 删除依赖项的下部
  2. 版本添加到pom.xml文件

休息的版本5.3.0

  1. Remove lower version of dependency
  2. Add below version to pom.xml file

Rest Assured version 5.3.0

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文