1
votes

I'm a newbie on gitlab-ci and get a trouble with maven. I'm using the library spring-cloud-contract to test my API. In the code I have this:

@AutoConfigureStubRunner(ids = {"my.groupid:artifactid:+:stubs"}, stubsMode = StubRunnerProperties.StubsMode.LOCAL)

I use the '+' to get the latest version of the stub. When the tests is executed, the library is looking for maven metadata to get the last version.

In my .gitlab-ci.yml, I configured maven with -Dmaven.repo.local=.m2/repository

Finally, I have the following error during the execution of the test:

Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'ClientContractTest$ServerConfiguration': Unsatisfied dependency expressed through field 'stubFinder'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'batchStubRunner' defined in class path resource [org/springframework/cloud/contract/stubrunner/spring/StubRunnerConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.cloud.contract.stubrunner.BatchStubRunner]: Factory method 'batchStubRunner' threw exception; nested exception is java.lang.IllegalArgumentException: For groupId [my.groupid] artifactId [artifactid] and classifier [stubs] the version was not resolved!

The following exceptions took place [org.eclipse.aether.transfer.MetadataNotFoundException: Could not find metadata my.groupid:artifactid/maven-metadata.xml in local (/builds/jeromevdl/project/myproject/.m2/repository)]

1

1 Answers

1
votes

It works when using -Dmaven.repo.local=/root/.m2/repository (full) instead of -Dmaven.repo.local=.m2/repository (relative)