[英]Unable to generate contract tests when using spring-cloud-contract-oa3 and spring cloud contract gradle plugin
[英]Spring Cloud Contract tests work with Maven but not when run with JUnit
我有一个包含两个模块的 Maven 项目,一个用于生产者,另一个用于消费者。
Project
-- Producer module
-- Consumer module
消费者包含对生产者存根的依赖,即
<dependency>
<groupId>com.example</groupId>
<artifactId>producer-application</artifactId>
<version>1.0.0-SNAPSHOT</version>
<classifier>stubs</classifier>
<scope>test</scope>
</dependency>
并且配置了集成测试,以便StubRunner
使用类路径扫描,即
@AutoConfigureStubRunner(
stubsMode = StubRunnerProperties.StubsMode.CLASSPATH,
ids = "com.example:producer-application:+:8090"
)
在构建期间,消费者的集成测试被正确执行,但如果我尝试通过 IDE (IntelliJ) 使用 JUnit 在本地运行测试,则找不到存根并且测试失败。
这是关于项目结构的问题吗? 如果是这样,是否可以更改某些内容以使其在不更改代码的情况下运行?
类路径在 ide 中不起作用,例如 Intellij 不会将存根 jar 添加到类路径中。 这是 ide 的一个已知问题。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.