Madhira Sitaram
Madhira Sitaram

Reputation: 13

Gradle: change is springboot version causes error

Have the following gradle, (basic one generated form start.spring.io). This compiles fine.

    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()
}

But as soon i change from version '2.2.6.RELEASE' to '2.3.0.M4'. The build errors out as below. Lot of solutions pointed out the repositories which imo seems correct. Help is greatly appreciated. My expectation was gradle removes the jars of older version and downloads fresh.

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```



Upvotes: 1

Views: 1204

Answers (1)

Cisco
Cisco

Reputation: 22952

You need to update the settings.gradle with the following:

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

By default Gradle only looks at the official Gradle Maven repository. Spring publishes milestones/prereleases to their own repository.

Upvotes: 2

Related Questions