Using Spring Cloud Contract 1.0.2.RELEASE, I'm able to publish the stubs in my local Maven repo, but they are not found by the consumer side when I run the tests.
It looks like on the consumer side, it picks a different location for local maven repo than what the producer has : despite good logging by Spring Cloud Contract and Aether libraries, it took me a while to figure it out, as the location I used for local Maven repo is similar (but different) to the default one.
I'm using Maven 3.3.1.
In org.springframework.cloud.contract.stubrunner.AetherFactories , we see clearly that it gets the local repository location like this :
private static final String MAVEN_LOCAL_REPOSITORY_LOCATION = "maven.repo.local";
private static String localRepositoryDirectory() {
return System.getProperty(MAVEN_LOCAL_REPOSITORY_LOCATION, System.getProperty("user.home") + "/.m2/repository");
}
So if you're overriding the local Maven repo location in your Maven settings.xml using something like this :
<localRepository>C:/HOMEWARE/maven_local_repo</localRepository>
your producer will install the stubs in this location, but the consumer will look in the default location for local repo, unless you define yourself the location through "maven.repo.local" system property.
You can do it like this using surefire on consumer side :
<build>
...
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<systemPropertyVariables>
<maven.repo.local>${settings.localRepository}</maven.repo.local>
</systemPropertyVariables>
</configuration>
</plugin>
</plugins>
</build>