打开这个网址 https://start.spring.io/
![](https://i-blog.csdnimg.cn/blog_migrate/15287bc79ed194e00423794411af1416.png)
点击GENERATE, 会一个项目报,解压缩后导入idea
![](https://i-blog.csdnimg.cn/blog_migrate/487da337b41f19bfaca61b39cacf3512.png)
导入得时候由于 services.gradle.org 下载很慢导致导入失败,后面换了国内的镜像
https://mirrors.cloud.tencent.com/gradle/
![](https://i-blog.csdnimg.cn/blog_migrate/016486c8368ba9c396f072cb24ff23e0.png)
但是又报了 一个错误
![](https://i-blog.csdnimg.cn/blog_migrate/6d392a9d2c8a8f0fc14256039d4c9719.png)
按照下2图配置后,还是报一样的错误
![](https://i-blog.csdnimg.cn/blog_migrate/49446825a122039d0e82e67e458fa64e.png)
![](https://i-blog.csdnimg.cn/blog_migrate/8036f6d66961f53933d5a04257298e2b.png)
最后,在一篇文章 https://cloud.tencent.com/developer/article/1486894 中里提到要配置下 gradle.properties
配置后 还是一样的错误 ,
继续查资料 ~~~
最后发现 gradle 与 jdk 还有版本对应关系
https://docs.gradle.org/current/userguide/compatibility.html#compatibility
![](https://i-blog.csdnimg.cn/blog_migrate/711da7c224a5bbd21395f8a5621c4738.png)
现在 工程里 , gradle 版本都 8.0.1 了 ,太高了,idea项目里的jdk还是8版本, 下载2.0版本的gradle 试试
![](https://i-blog.csdnimg.cn/blog_migrate/6c119b83891cf1610c5ffe93ced115eb.png)
又报错了,
![](https://i-blog.csdnimg.cn/blog_migrate/784ffc533e035c0de96b45906a9e6a5f.png)
从错误中看, 是让升级到 2.6 及 以后的版本 ,我们升级到 2版本的最大版本 2.9 试试
![](https://i-blog.csdnimg.cn/blog_migrate/7c4d59655d0fff23ec5d89f48dc50ed3.png)
![](https://i-blog.csdnimg.cn/blog_migrate/2179ac1c30a8e5a4dd8199dde58b83d2.png)
这次 jdk 版本又有要求了, 哎, 还是换到 2.6吧
![](https://i-blog.csdnimg.cn/blog_migrate/9f8f64ad3deb3602d867eb3b29ce9257.png)
还是一样的错, 看错误里建议 , 换成 4.8.1 ,在试
![](https://i-blog.csdnimg.cn/blog_migrate/24b230a59fb685ec30b131fc75d75a16.png)
又报了这~~, 看报错 还是gradle 的版本问题 , 换6.8 试试
![](https://i-blog.csdnimg.cn/blog_migrate/52ef2a3b5bf6c2954abf84a1182362db.png)
![](https://i-blog.csdnimg.cn/blog_migrate/0127402db022c6df2e4a19243e97801d.png)
这回感觉版本对上了 , 继续看具体报错内容
Download https://mirrors.cloud.tencent.com/gradle/gradle-6.8-all.zip (150.6 MB)
Download https://mirrors.cloud.tencent.com/gradle/gradle-6.8-all.zip finished succeeded, took 34 s 975 ms
Starting Gradle Daemon...
Gradle Daemon started in 2 s 140 ms
> Task :prepareKotlinBuildScriptModel UP-TO-DATE
<ij_msg_gr>Project annotation processor import errors<ij_msg_gr><ij_nav>D:\code\demo\dockerfile-demo\build.gradle<ij_nav><i><b>root project 'dockerfile-demo': Unable to create annotation processors model</b><eol>Details: org.gradle.api.GradleException: Failed to resolve imported Maven boms: Connection timed out: connect<eol>Caused by: org.gradle.api.artifacts.ResolveException: Could not resolve all dependencies for configuration ':detachedConfiguration1'.<eol>Caused by: org.gradle.internal.resolve.ModuleVersionResolveException: Could not resolve org.springframework.boot:spring-boot-dependencies:2.7.9.<eol>Required by:<eol> project :<eol>Caused by: org.gradle.internal.resolve.ModuleVersionResolveException: Could not resolve org.springframework.boot:spring-boot-dependencies:2.7.9.<eol>Caused by: org.gradle.api.resources.ResourceException: Could not get resource 'Caused" target="_blank">https://repo.maven.apache.org/maven2/org/springframework/boot/spring-boot-dependencies/2.7.9/spring-boot-dependencies-2.7.9.pom'.<eol>Caused by: org.gradle.internal.resource.transport.http.HttpRequestException: Could not HEAD 'Caused" target="_blank">https://repo.maven.apache.org/maven2/org/springframework/boot/spring-boot-dependencies/2.7.9/spring-boot-dependencies-2.7.9.pom'.<eol>Caused by: org.apache.http.conn.HttpHostConnectException: Connect to repo.maven.apache.org:443 [repo.maven.apache.org/146.75.112.215] failed: Connection timed out: connect<eol>Caused by: java.net.ConnectException: Connection timed out: connect</i>
Could not resolve: org.springframework.boot:spring-boot-starter-web
Could not resolve: org.springframework.boot:spring-boot-starter-test
BUILD SUCCESSFUL in 3m 4s
应该是连中央仓库失败了,看看怎么配置连国内仓库或者私有仓库
参考 https://juejin.cn/post/7052204121113231396 配置了下仓库
![](https://i-blog.csdnimg.cn/blog_migrate/a67fae950e1c7944ee71e160514451b1.png)
![](https://i-blog.csdnimg.cn/blog_migrate/26505d2eddbec1a0d377357d90d78dd2.png)
终于成功了~~~