Skip to content

spring-cloud-stub-runner issue with downloading pact contracts #264

@naushadamin

Description

@naushadamin

Describe the bug
I've a consumer project which published a Pact contract to a remote pact repo successfully. Now I am trying to auto-generate the verifier test in Producer project using spring-cloud-contract-pact project. I added the following bits in by build.gradle file to configure test generation:

contractsMode = "REMOTE"
    	// Base package for generated tests
    	baseClassForTests = "somebaseclass"
    	contractRepository {
    		repositoryUrl = "pact://https://namin.pactflow.io"
    	}

When I build my project it fails. Upon further investigation, I found the copyContract gradle task is failing with the following:

2021-06-23T07:01:10.922-0400 [DEBUG] [org.springframework.cloud.contract.stubrunner.StubRunnerOptions] File not found
java.io.FileNotFoundException: class path resource [pact://https://namin.pactflow.io] cannot be resolved to URL because it does not exist
	at org.springframework.core.io.ClassPathResource.getURL(ClassPathResource.java:202)
	at org.springframework.core.io.AbstractResource.getURI(AbstractResource.java:123)
	at org.springframework.cloud.contract.stubrunner.StubRunnerOptions.getStubRepositoryRootAsString(StubRunnerOptions.java:263)
	at org.springframework.cloud.contract.stubrunner.AetherStubDownloader.remoteRepositories(AetherStubDownloader.java:144)
	at org.springframework.cloud.contract.stubrunner.AetherStubDownloader.<init>(AetherStubDownloader.java:83)
	at org.springframework.cloud.contract.stubrunner.AetherStubDownloaderBuilder.build(AetherStubDownloaderBuilder.java:38)

I am following the example from your sample producer-pact directory here. Not sure what needs to be configured to resolve the issue. Also, I noticed that currently username/password based authentication is supported. However, I have configured authentication to my pact repo using bearer token. Is token based authentication supported?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions