Spring Cloud Contract Maven插件未将jar安装到本地.m2文件夹

时间:2019-05-03 12:10:48

标签: testing spring-cloud wiremock spring-cloud-contract

我的生产者项目的pom.xml中有spring-cloud-contract-maven-plugin。当我使用下面的插件时,它没有将jar安装到.m2存储库中。

我尝试添加多个版本的spring-cloud-contract和2.0.2.RELEASE似乎仅能稳定地成功构建。

` <plugin>
        <groupId>org.springframework.cloud</groupId>
        <artifactId>spring-cloud-contract-maven-plugin</artifactId>
        <version>2.0.2.RELEASE</version>
        <!--<executions>-->
          <!--<execution>-->
            <!--<goals>-->
              <!--<goal>convert</goal>-->
              <!--<goal>generateStubs</goal>-->
              <!--<goal>generateTests</goal>-->
            <!--</goals>-->
          <!--</execution>-->
        <!--</executions>-->
        <extensions>true</extensions>
        <configuration>
     <packageWithBaseClasses>com.sam.fraud.fcm.fraudcase.gateway.test.contracts</packageWithBaseClasses>
        </configuration>
      </plugin>`

如果将上述插件添加到pom中,则根本不会安装.m2文件夹,因此会生成存根但在目标文件夹中却不会更新.m2

`[INFO] Installing com.sam.fraud.fcm:fraud-case-gateway-api:1.0.0-SNAPSHOT at end`

如果我删除插件或将其注释掉,则会得到以下内容,该文件可以正常安装并正常工作,但是目标中未生成存根,这是我需要的。

`[INFO] Installing C:\Users\sam\FCM-forks\fraud-case-gateway-contract-tests\api\pom.xml to C:\Users\sam\.m2\repositoryFCM2\com\sam\fraud\fcm\fraud-case-gateway-api\1.0.0-SNAPSHOT\fraud-case-gateway-api-1.0.0-SNAPSHOT.pom`

我需要正确的插件,因为它与测试和程序包的基类一起使用。我也尝试过

 `<baseClassForTests>
          com.sam.fraud.fcm.fraudcase.gateway.test.contracts.RepreclientBase
        </baseClassForTests>`

1 个答案:

答案 0 :(得分:1)

感谢Marcin,但看起来我想出了问题,它是mvn-install插件版本,没有在本地上传jar,我将版本从2.5.4还原为2.4,因此效果很好。

Alsom无限例外与Spring Boot 2中的wiremock-servlet问题有关。 使用$xml | Select-Xml -XPath "//feature[@resource_id='550']/current_option[.='AUTO']" | ForEach-Object { $_.Node.InnerText = 'PLAIN' } 版本可以帮助我成功构建和运行应用程序。