【发布时间】:2018-06-08 07:11:14
【问题描述】:
我是 gitlab-ci 的新手,在使用 maven 时遇到了麻烦。我正在使用库 spring-cloud-contract 来测试我的 API。在代码中我有这个:
@AutoConfigureStubRunner(ids = {"my.groupid:artifactid:+:stubs"}, stubsMode = StubRunnerProperties.StubsMode.LOCAL)
我使用“+”来获取最新版本的存根。执行测试时,库正在寻找 maven 元数据以获取最新版本。
在我的 .gitlab-ci.yml 中,我使用 -Dmaven.repo.local=.m2/repository 配置了 maven
最后在执行测试的过程中出现如下错误:
上下文初始化期间遇到异常 - 取消 刷新尝试: org.springframework.beans.factory.UnsatisfiedDependencyException: 使用名称创建 bean 时出错 'ClientContractTest$ServerConfiguration': 通过字段 'stubFinder' 表达的不满足的依赖关系;嵌套的 例外是 org.springframework.beans.factory.BeanCreationException: 在类路径中定义名称为“batchStubRunner”的 bean 创建错误 资源 [org/springframework/cloud/contract/stubrunner/spring/StubRunnerConfiguration.class]: 通过工厂方法实例化 Bean 失败;嵌套异常是 org.springframework.beans.BeanInstantiationException:失败 实例化 [org.springframework.cloud.contract.stubrunner.BatchStubRunner]: 工厂方法“batchStubRunner”抛出异常;嵌套异常是 java.lang.IllegalArgumentException:对于 groupId [my.groupid] artifactId [artifactid] 和分类器 [stubs] 版本是 没有解决!
发生以下异常 [org.eclipse.aether.transfer.MetadataNotFoundException:找不到 元数据 my.groupid:artifactid/maven-metadata.xml 在本地 (/builds/jeromevdl/project/myproject/.m2/repository)]
【问题讨论】:
标签: maven gitlab-ci spring-cloud-contract