Skip to content

Exception occurred while trying to fetch the stubs #2419

@TiomanGally

Description

@TiomanGally

Describe the bug
We are upgrading our application from Spring Boot 3.5.9 to Spring Boot 4.0.2 (spring-cloud-starter-contract-stub-runner from 4.3.0 to 5.0.2)
and do get this error:

java.lang.IllegalArgumentException: For groupId [internal.contracts] artifactId [api] and classifier [stubs] the version was not resolved! 
The following exceptions took place [org.eclipse.aether.transfer.MetadataNotFoundException: Could not find metadata internal.contracts:api/maven-metadata.xml in local (/var/folders/bk/8clkbs_j6mj84ck9cthn081m0000gn/T/aether-local16285325284454063319), 
org.eclipse.aether.transfer.MetadataTransferException: Could not transfer metadata internal.contracts:api/maven-metadata.xml from/to remote0 (http://internal/content/groups/public): 
Cannot access http://internal/content/groups/public with type default using the available connector factories: BasicRepositoryConnectorFactory]
...
[main] WARN org.springframework.cloud.contract.stubrunner.CompositeStubDownloader -- Stub Downloader [org.springframework.cloud.contract.stubrunner.AetherStubDownloader] failed to find an entry for [internal.contracts:api:+:stubs]. Will proceed to the next one
...
[main] WARN org.springframework.cloud.contract.stubrunner.CompositeStubDownloader -- No matching stubs or contracts were found

Used technologies
Apache Maven 3.9.10 (5f519b97e944483d878815739f519b2eade0a91d)
Maven home: /Users/xx/.sdkman/candidates/maven/current
Java version: 21.0.7, vendor: Eclipse Adoptium, runtime: /Users/xx/.sdkman/candidates/java/21.0.7-tem
Default locale: en_US, platform encoding: UTF-8
OS name: "mac os x", version: "26.2", arch: "aarch64", family: "mac"

Sample
Our pom.xml

<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-test</artifactId>
    <scope>test</scope>
</dependency>
<dependency>
    <groupId>org.springframework.cloud</groupId>
    <artifactId>spring-cloud-starter-contract-stub-runner</artifactId>
</dependency>
<dependency>
    <groupId>org.springframework.cloud</groupId>
    <artifactId>spring-cloud-contract-wiremock</artifactId>
</dependency>

our ContractTest:

@AutoConfigureStubRunner(
    stubsMode = StubRunnerProperties.StubsMode.REMOTE,
    repositoryRoot = "http://internal/content/groups/public",
    stubsPerConsumer = true,
    consumerName = "consumer",
    ids = { "internal.contracts:api:+:stubs:${wiremock.server.port}" })

the contract itself is there and it still works with the older version:
curl -v http://internal/content/groups/public/internal/contracts/api/maven-metadata.xml
will give a < HTTP/1.1 200 OK with its list of version. Besides that it still works with the 4.3.0

I found a similar error (#2362) and tried using the same mvn version with the SNAPSHOT without any success.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions