【问题标题】:Spring Boot plugin was not found找不到 Spring Boot 插件
【发布时间】:2019-10-01 14:33:44
【问题描述】:

我对 gradle 项目有疑问

我的build.gradle

buildscript {
    ext {
        springBootVersion = '2.1.8.RELEASE'
    }
    repositories {
        mavenCentral()
    }
    dependencies {
        classpath(
                "org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
    }
}

plugins {
    id 'org.springframework.boot' version '2.1.8.RELEASE'
}

apply plugin: 'org.springframework.boot'

group = 'com.demo'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = '1.8'

repositories {
    mavenCentral()
}

dependencies {
    implementation 'org.springframework.boot:spring-boot-starter-actuator'
    implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
    implementation 'org.springframework.boot:spring-boot-starter-security'
    implementation 'org.springframework.boot:spring-boot-starter-web'
    runtimeOnly 'mysql:mysql-connector-java'
    providedRuntime 'org.springframework.boot:spring-boot-starter-tomcat'
    testImplementation 'org.springframework.boot:spring-boot-starter-test'
    testImplementation 'org.springframework.security:spring-security-test'
}

当我尝试运行 build.gralde 时,出现错误

Plugin [id: 'org.springframework.boot', version: '2.1.8.RELEASE'] was not found in any of the following sources:

IDEA 中的 Gradle 偏好

我不明白,什么问题,我用 Spring Initializer 生成了项目

【问题讨论】:

  • 重启IDE并导入项目后能否分享idea.log("Help | Show Log in...")?

标签: spring-boot gradle intellij-idea


【解决方案1】:

我想,我有问题。 您只需要关闭“离线模式”,它就会从 repo 下载它

它位于 Intellij IDEA 的右侧

【讨论】:

    【解决方案2】:

    一种可能的解释是,通过显式配置buildscript.repositories,您不再拥有默认的gradlePluginPortal()。 例如,并非所有插件都在 Maven Central 上可用。

    【讨论】:

      猜你喜欢
      • 2014-12-22
      • 2019-01-17
      • 2018-01-29
      • 2020-12-30
      • 2021-03-11
      • 2019-04-17
      • 1970-01-01
      • 2016-02-07
      • 2019-01-23
      相关资源
      最近更新 更多