Halo项目编译之Gradle设置
一 报错提示
下载Halo项目(版本:`version=2.4.0-SNAPSHOT`),在本地编译期间,遇到如下所示问题:
节选报错提示如下:
A problem occurred configuring root project 'halo'.
> Could not resolve all files for configuration ':classpath'.
> Could not resolve org.springframework.boot:spring-boot-gradle-plugin:3.0.3.
Required by:
project : > org.springframework.boot:org.springframework.boot.gradle.plugin:3.0.3
> No matching variant of org.springframework.boot:spring-boot-gradle-plugin:3.0.3 was found. The consumer was configured to find a runtime of a library compatible with Java 11, packaged as a jar, and its dependencies declared externally, as well as attribute 'org.gradle.plugin.api-version' with value '7.4' but:
二 解决措施
经检查,发现是Idea导入项目的时候,Gradle插件默认使用的语言级别是11(`build.gradle`中设置:sourceCompatibility = JavaVersion.VERSION_17)。
调整步骤如下图所示:
将上图中的红框部分,修改为17即可完成正常编译。