首页 > 解决方案 > Swagger codegen 降级 gradle 版本

问题描述

我在 Eclipse 中创建了一个 gradle spring boot 项目。现在我想添加一个由我放入项目中的 swagger-codegen-cli.jar(版本 3.0.20)生成的客户端。

执行后

java -jar swagger-codegen-cli.jar generate -i https://petstore.swagger.io/v2/swagger.yaml -l java --library resttemplate  > msg.txt

在 powershell 中,某些 gradle 文件被覆盖。最引人注目的gradle-wrapper.properties改变了这条线

distributionUrl=https\://services.gradle.org/distributions/gradle-6.4.1-bin.zip

.../gradle-2.6-bin.zip添加 2016 年的时间戳?!

我也得到错误:

Description Resource    Path    Location    Type
Could not fetch model of type 'EclipseProject' using Gradle distribution 'https://services.gradle.org/distributions/gradle-2.6-bin.zip'.
Build file 'C:\Users\me\workspace\projectname\build.gradle' line: 2
An exception occurred applying plugin request [id: 'org.springframework.boot', version: '2.3.1.RELEASE']
Failed to apply plugin [id 'org.springframework.boot']
Spring Boot plugin requires Gradle 5 (5.6.x only) or Gradle 6 (6.3 or later). The current version is Gradle 2.6 build.gradle    /demo   line 2  Gradle Error Marker

我试图将版本号更改回gradle-wrapper.properties,但仅此一项似乎无济于事。但是 grep 没有发现任何其他出现的 '2.6' 我想了解为什么 gradle 版本会更改以及如何避免这种情况。

标签: javaspringspring-bootgradleswagger-codegen

解决方案


推荐阅读