春云合约无法从 Nexus 查找/下载工件,存根模式远程



从消费者的角度来看,我正在尝试将具有存根模式的 Nexus 存储库称为远程,但我收到错误,下载存根时找不到工件或异常。

有人可以帮助我吗?

@AutoConfigureStubRunner(ids = "com.common.service:Common-Service-STUB:1.0.0-SNAPSHOT", stubsMode = StubRunnerProperties.StubsMode.REMOTE, repositoryRoot = "https://nexus.prod.cloud.XXX.com:8443/nexus/content/repositories/XXX-snapshot", stubsPerConsumer = true)

存储库结构

com
 - common
 - - service
 - - - Common-Service
 - - - Common-Service-STUB
 - - - - 1.0.0-Timestamp
 - - - - - Common-Service-STUB-1.0.0-Timestamp.jar
 - - - - 1.0.0-SNAPSHOT
 - - - - - maven-metadata.xml (this has the most recent Timestamp)

异常堆栈跟踪

Caused by: java.lang.IllegalStateException: Exception occurred while trying to download a stub for group [com.common.service] module [Common-Service-STUB] and classifier [stubs] in [remote0 (Valid Nexus-Repo-snapshot)]
    at org.springframework.cloud.contract.stubrunner.AetherStubDownloader.unpackedJar(AetherStubDownloader.java:184)
    at org.springframework.cloud.contract.stubrunner.AetherStubDownloader.downloadAndUnpackStubJar(AetherStubDownloader.java:222)
    at org.springframework.cloud.contract.stubrunner.CompositeStubDownloader.downloadAndUnpackStubJar(CompositeStubDownloaderBuilder.java:77)
    at org.springframework.cloud.contract.stubrunner.StubRunnerFactory.createStubsFromServiceConfiguration(StubRunnerFactory.java:60)
    at org.springframework.cloud.contract.stubrunner.BatchStubRunnerFactory.buildBatchStubRunner(BatchStubRunnerFactory.java:59)
    at org.springframework.cloud.contract.stubrunner.spring.StubRunnerConfiguration.batchStubRunner(StubRunnerConfiguration.java:78)
    at org.springframework.cloud.contract.stubrunner.spring.StubRunnerConfiguration$$EnhancerBySpringCGLIB$$c9316bb9.CGLIB$batchStubRunner$0(<generated>)
    at org.springframework.cloud.contract.stubrunner.spring.StubRunnerConfiguration$$EnhancerBySpringCGLIB$$c9316bb9$$FastClassBySpringCGLIB$$b60005.invoke(<generated>)
    at org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:228)
    at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:361)
    at org.springframework.cloud.contract.stubrunner.spring.StubRunnerConfiguration$$EnhancerBySpringCGLIB$$c9316bb9.batchStubRunner(<generated>)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:154)
    ... 67 more
Caused by: org.eclipse.aether.resolution.ArtifactResolutionException: Could not find artifact com.common.service:Common-Service-STUB:jar:stubs:1.0.0-SNAPSHOT in remote0 (Valid Nexus-Repo-snapshot)
    at shaded.org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolve(DefaultArtifactResolver.java:444)
    at shaded.org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolveArtifacts(DefaultArtifactResolver.java:246)
    at shaded.org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolveArtifact(DefaultArtifactResolver.java:223)
    at shaded.org.eclipse.aether.internal.impl.DefaultRepositorySystem.resolveArtifact(DefaultRepositorySystem.java:294)
    at org.springframework.cloud.contract.stubrunner.AetherStubDownloader.unpackedJar(AetherStubDownloader.java:168)
    ... 82 more
Caused by: org.eclipse.aether.transfer.ArtifactNotFoundException: Could not find artifact com.common.service:Common-Service-STUB:jar:stubs:1.0.0-SNAPSHOT in remote0 (Valid Nexus-Repo-snapshot)
    at shaded.org.eclipse.aether.connector.basic.ArtifactTransportListener.transferFailed(ArtifactTransportListener.java:39)
    at shaded.org.eclipse.aether.connector.basic.BasicRepositoryConnector$TaskRunner.run(BasicRepositoryConnector.java:355)
    at org.eclipse.aether.util.concurrency.RunnableErrorForwarder$1.run(RunnableErrorForwarder.java:67)
    at shaded.org.eclipse.aether.connector.basic.BasicRepositoryConnector$DirectExecutor.execute(BasicRepositoryConnector.java:581)
    at shaded.org.eclipse.aether.connector.basic.BasicRepositoryConnector.get(BasicRepositoryConnector.java:249)
    at shaded.org.eclipse.aether.internal.impl.DefaultArtifactResolver.performDownloads(DefaultArtifactResolver.java:520)
    at shaded.org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolve(DefaultArtifactResolver.java:421)
    ... 86 more

让我们看看你在注释中写了什么。 com.common.service:Common-Service-STUB:1.0.0-SNAPSHOT .这意味着您的组 ID com.common.service,您的工件 ID common-service-stub,您的版本是 1.0.0-SNAPSHOT 。此外,默认分类器为 stub 。因此,您正在寻找一个名为 Common-Service-STUB 的带有stub分类器的工件。换句话说,Common-Service-STUB-stub.jar被搜索。将com.common.service:Common-Service-STUB:1.0.0-SNAPSHOT更改为com.common.service:Common-Service:1.0.0-SNAPSHOT

最新更新