I am new to Spring cloud contract testing. I am to publish the stub jar to Jfrog artifactory from the producer side.
Following Gradle code:
publishing {
publications {
maven(MavenPublication) {
artifact("build/libs/provider-service-$version"+"-stubs.jar") {
extension 'jar'
}}}
repositories {
maven {
name 'libs-snapshot'
url "http://localhost:8081/artifactory/libs-snapshot/"
credentials {
username project.repoUser
password project.repoPassword
}
}
}
}
But on the consumer side I am not able to read the jar. I am getting the following error to read the jar.
Code:
@AutoConfigureStubRunner(ids = "com.test:provider-service:+:stubs:8082",
consumerName = "contracts",
properties = {"stubrunner.username=admin", "stubrunner.password=Cirrus123$"},
stubsPerConsumer = true,
stubsMode = StubRunnerProperties.StubsMode.REMOTE,
repositoryRoot = "http://localhost:8081/artifactory/libs-snapshot/")
Error:
java.lang.IllegalArgumentException: For groupId [com.test] artifactId [provider-service] and classifier [stubs] the version was not resolved! The following exceptions took place [org.eclipse.aether.transfer.MetadataNotFoundException: Could not find metadata com.test:provider-service/maven-metadata.xml in local (C:\Users\test\AppData\Local\Temp\aether-local7525112400154924089), org.eclipse.aether.transfer.MetadataTransferException: Could not transfer metadata com.test:provider-service/maven-metadata.xml from/to remote0 (http://localhost:8081/artifactory/libs-snapshot/): status code: 401, reason phrase: Unauthorized (401)]
But I am using the correct credentials to connect to Jfrog