简体   繁体   中英

How to skip the test generation maven goal with Spring Cloud Contract Verifier?

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM