插件 [id: 'org.springframework.boot', 版本: '2.7.3'] 在以下任何来源中都找不到:



我从http://start.spring.io我得到了一个错误。请帮我弄清楚。

我的build.gradle

plugins {
id 'org.springframework.boot' version '2.7.3'
id 'io.spring.dependency-management' version '1.0.13.RELEASE'
id 'java'
}
group = 'com.murprog'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = '18'
repositories {
mavenCentral()
}
dependencies {
implementation 'org.springframework.boot:spring-boot-starter'
testImplementation 'org.springframework.boot:spring-boot-starter-test'
}
tasks.named('test') {
useJUnitPlatform()
}

错误

Build file 'D:javamyblog_grdbuild.gradle' line: 2
Plugin [id: 'org.springframework.boot', version: '2.7.3'] was not found in any of the following sources:
* Try:
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
* Exception is:
org.gradle.api.plugins.UnknownPluginException: Plugin [id: 'org.springframework.boot', version: '2.7.3'] was not found in any of the following sources:
- Gradle Core Plugins (plugin is not in 'org.gradle' namespace)
- Plugin Repositories (could not resolve plugin artifact 'org.springframework.boot:org.springframework.boot.gradle.plugin:2.7.3')
Searched in the following repositories:
Gradle Central Plugin Repository
  1. 尝试使用Java 11和spring-boot插件2.7.12构建一个项目。这会奏效的

  1. 尝试升级Java,spring-boot插件

项目的build.gradle文件配置错误,导致了此问题。您应该在build.gradle文件中包含buildscript块,因为build.gradle脚本本身需要它

看起来与活动Java版本和sourceCompatibility中提到的版本不一致。在Project窗口中打开External Libraries,Java版本应该相同(在您的情况下为< 18 >(。

最新更新