I want to test a service Consumer that uses FeignClient to call another service, Producer, that I have. In order to stub the service called, I'm using spring-cloud-contract-verifier for the producer and spring-cloud-contract-stub-runner on the consumer.
My problem is that I already have written integration tests for the producer, so I'd just like to generate the stubs and skip the tests generation. Using the spring-cloud-contract-maven-plugin, I've tried to set up only the goals I need, but it's still trying to run the tests anyway. I suspect I'm not setting it up correctly...
<plugin>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-contract-maven-plugin</artifactId>
<version>${spring-cloud-contract.version}</version>
<extensions>true</extensions>
<executions>
<execution>
<goals>
<goal>convert</goal>
<goal>generateStubs</goal>
</goals>
<configuration>
<basePackageForTests>com.example</basePackageForTests>
</configuration>
</execution>
</executions>
</plugin>
when I run mvn clean install, it's still expecting a TestBase. How can I skip this goal?
If you check the documentation (https://cloud.spring.io/spring-cloud-static/spring-cloud-contract/1.2.4.RELEASE/spring-cloud-contract-maven-plugin/generateTests-mojo.html) you'll see that you can do a number of things. -DskipTests
, -Dspring.cloud.contract.verifier.skip=true
. Always read the documentation.