尝试生成 spring 云合同时找不到 ContractVerifierUtil class
Cannot find ContractVerifierUtil class while trying to generate spring cloud contracts
我正在尝试为我的 API 生成云合同,但构建失败,因为生成的测试 class 无法从依赖项中找到以下 class。
Compilation failure--import static org.springframework.cloud.contract.verifier.util.ContractVerifierUtil.*;
[ERROR] ContractVerifierTest.java:[18,63] cannot find symbol
[ERROR] symbol: class ContractVerifierUtil
[ERROR] location: package org.springframework.cloud.contract.verifier.util
这些是我在 pom.xml
中的依赖项
<dependency>
<groupId>com.atlassian.oai</groupId>
<artifactId>swagger-request-validator-mockmvc</artifactId>
<version>2.10.1</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<version>2.3.0.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-contract-verifier</artifactId>
<version>2.2.3.RELEASE</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-dependencies</artifactId>
<version>Hoxton.RELEASE</version>
<type>pom</type>
<scope>import</scope>
</dependency>
和我的 maven 插件配置
<plugin>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-contract-maven-plugin</artifactId>
<version>2.1.1.RELEASE</version>
<extensions>true</extensions>
<configuration>
<baseClassForTests>
com.test.specValidation.ContractTest
</baseClassForTests>
</configuration>
</plugin>
我看过类似的post but the version looks compatible as per spring cloud docs
Table 1. Release train Spring Boot compatibility
Release Train Boot Version
Hoxton
2.2.x
我试过多个版本,但似乎都不行。关于我遗漏的任何指导?
请将插件版本与合约依赖版本对齐。您在版本 2.2.3.RELEASE 中使用验证程序,但该插件在版本 2.1.1.RELEASE 中。它们必须在同一版本中使用。
我正在尝试为我的 API 生成云合同,但构建失败,因为生成的测试 class 无法从依赖项中找到以下 class。
Compilation failure--import static org.springframework.cloud.contract.verifier.util.ContractVerifierUtil.*;
[ERROR] ContractVerifierTest.java:[18,63] cannot find symbol
[ERROR] symbol: class ContractVerifierUtil
[ERROR] location: package org.springframework.cloud.contract.verifier.util
这些是我在 pom.xml
中的依赖项 <dependency>
<groupId>com.atlassian.oai</groupId>
<artifactId>swagger-request-validator-mockmvc</artifactId>
<version>2.10.1</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<version>2.3.0.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-contract-verifier</artifactId>
<version>2.2.3.RELEASE</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-dependencies</artifactId>
<version>Hoxton.RELEASE</version>
<type>pom</type>
<scope>import</scope>
</dependency>
和我的 maven 插件配置
<plugin>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-contract-maven-plugin</artifactId>
<version>2.1.1.RELEASE</version>
<extensions>true</extensions>
<configuration>
<baseClassForTests>
com.test.specValidation.ContractTest
</baseClassForTests>
</configuration>
</plugin>
我看过类似的post but the version looks compatible as per spring cloud docs
Table 1. Release train Spring Boot compatibility
Release Train Boot Version
Hoxton
2.2.x
我试过多个版本,但似乎都不行。关于我遗漏的任何指导?
请将插件版本与合约依赖版本对齐。您在版本 2.2.3.RELEASE 中使用验证程序,但该插件在版本 2.1.1.RELEASE 中。它们必须在同一版本中使用。