java - Gradle : change is springboot version causes error

标签 java spring-boot gradle compiler-errors versioning

有以下gradle,(从start.spring.io基本生成一个)。这样编译就可以了。

    id 'org.springframework.boot' version '2.2.6.RELEASE'
    id 'io.spring.dependency-management' version '1.0.9.RELEASE'
    id 'java'
}

group = 'com.svadhyayanetworks'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = '11'

configurations {
    developmentOnly
    runtimeClasspath {
        extendsFrom developmentOnly
    }
}

repositories {
    mavenCentral()
    maven { url 'https://repo.spring.io/milestone' }
}

ext {
    set('springCloudVersion', "Hoxton.SR3")
}

dependencies {
    implementation 'org.springframework.cloud:spring-cloud-config-server'
    implementation 'org.springframework.boot:spring-boot-starter'
    developmentOnly 'org.springframework.boot:spring-boot-devtools'
    testImplementation('org.springframework.boot:spring-boot-starter-test') {
        exclude group: 'org.junit.vintage', module: 'junit-vintage-engine'
    }
}
dependencyManagement {
    imports {
        mavenBom "org.springframework.cloud:spring-cloud-dependencies:${springCloudVersion}"
    }
}

test {
    useJUnitPlatform()
}

但是,一旦我从版本“2.2.6.RELEASE”更改为“2.3.0.M4”。生成错误如下。
许多解决方案指出了imo似乎正确的存储库。
非常感谢您的帮助。
我的期望是gradle删除了较旧版本的jar,并重新下载了。
org.gradle.api.plugins.UnknownPluginException: Plugin [id: 'org.springframework.boot', version: '2.3.0.M4'] 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.3.0.M4')
  Searched in the following repositories:
    Gradle Central Plugin Repository```



最佳答案

您需要使用以下更新settings.gradle:

pluginManagement {
  repositories {
    maven {
      url 'https://repo.spring.io/milestone'
    }
    gradlePluginPortal()
  }
}

默认情况下,Gradle仅查看官方的Gradle Maven存储库。 Spring将里程碑/预发行版发布到其自己的存储库中。

关于java - Gradle : change is springboot version causes error,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61290221/

相关文章:

java - 复制构造函数类实例化

java - gwt-bootstrap 可以在 UiBinder 之外工作吗?

Android Studio 总是重建应用程序

java - 带有yml配置文件的gradle jar文件未从dockerfile执行

java - JAXB:解码异构数组

java - Terracotta 和 Quartz 调度程序节点使用什么协议(protocol)?

serialization - Spring中的依赖注入(inject)和序列化对象

gradle - Gradle左移运算符(<<)vs doLast行为差异

java - 如何将参数传递给spring数据存储库

spring-boot - Spring Boot 2.1.0使用Kotlin数据类更改安全性?