目录

1.更换java版本,

1.File->Project Structure->project setting->Project

2.File->setting->Build,Excution,Deployment->Gradle->gradle JVM

3.gradle.build.kts配置文件

2.自己新建一个基于gradle springboot的新项目,先将这个项目跑通,也就是build成功(我好像就是这样好的,这个过程中会下载很多文件,因为初次build嘛)

3.改下载源加速

4.结语


本项目是基于gradle kotlin管理springboot项目的

gradle跑拉取的项目错误

拉取项目gradle版本8.5

springboot3.2

本地gradle版本8.2

A problem occurred configuring root project 'web-voyager-ddd'.
> Could not resolve all files for configuration ':classpath'.
   > Could not resolve org.springframework.boot:spring-boot-gradle-plugin:3.2.3.
     Required by:
         project : > org.springframework.boot:org.springframework.boot.gradle.plugin:3.2.3
      > No matching variant of org.springframework.boot:spring-boot-gradle-plugin:3.2.3 was found. The consumer was configured to find a library for use during runtime, compatible with Java 8, packaged as a jar, and its dependencies declared externally, as well as attribute 'org.gradle.plugin.api-version' with value '8.5' but:
          - Variant 'apiElements' capability org.springframework.boot:spring-boot-gradle-plugin:3.2.3 declares a library, packaged as a jar, and its dependencies declared externally:
              - Incompatible because this component declares a component for use during compile-time, compatible with Java 17 and the consumer needed a component for use during runtime, compatible with Java 8
              - Other compatible attribute:
                  - Doesn't say anything about org.gradle.plugin.api-version (required '8.5')

按理来说,gradle是支持跨版本的,毕竟gradle wraaper就算你本地没用gradle gradle wrapper

也会帮你下载好

于是我在调试中总结了一下方法(我也在稀里糊涂中debug好了)

1.更换java版本,

注意有些gradle版本和springboot版本是不支持低版本java的,如java8,我本机一般用的java19,但也安装了java8,推荐java17及以上

包括3处地方

1.File->Project Structure->project setting->Project

2.File->setting->Build,Excution,Deployment->Gradle->gradle JVM

3.gradle.build.kts配置文件

下面languageVersion

2.自己新建一个基于gradle springboot的新项目,先将这个项目跑通,也就是build成功(我好像就是这样好的,这个过程中会下载很多文件,因为初次build嘛)

在new project(只有idea企业版有这个spring initialzer大家可以去找破解版,我的就是破解的,也可以去这里新建,一样的spring)

然后next

这边会有一个默认的springboot版本,别改它,一般是2.几

顺便勾选web

点create

然后进去刷新gradle.build.kts的刷新

然后就会开始下载好多文件,如果有报错的话应该也不难,我的是java版本问题,看报错信息就可以很快解决

3.改下载源加速

注意这边下载一定要更换国内下载,国外下载慢的一批

在gradle-wrapper.properties下修改

把Url改成阿里腾讯就好了,我这边改的是腾讯

distributionUrl=https\://mirrors.cloud.tencent.com/gradle/gradle-8.2-bin.zip

4.结语

反正拉取下来报一大堆问题,一般就是版本问题,要么是java版本,要么是gradle版本,要么是springboot版本,各种版本尝试下就好了 

Logo

魔乐社区(Modelers.cn) 是一个中立、公益的人工智能社区,提供人工智能工具、模型、数据的托管、展示与应用协同服务,为人工智能开发及爱好者搭建开放的学习交流平台。社区通过理事会方式运作,由全产业链共同建设、共同运营、共同享有,推动国产AI生态繁荣发展。

更多推荐