Created a fresh Spring boot project via Spring initializer.
Gradle wrapper (distribution URL) - https://services.gradle.org/distributions/gradle-7.1.1-bin.zip
Springboot version - 2.5.4
Getting following error when trying to build the project for the first time.
gradlew clean build -x test
- What went wrong:
Plugin [id: ‘org.springframework.boot’, version: ‘2.5.4’] 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.5.4’)
Searched in the following repositories:
Gradle Central Plugin Repository
build.gradle file content
plugins {
id ‘org.springframework.boot’ version ‘2.5.4’
id ‘io.spring.dependency-management’ version ‘1.0.11.RELEASE’
id ‘java’
}
group = ‘com.mtnsa’
version = ‘0.0.1-SNAPSHOT’
sourceCompatibility = ‘11’
repositories {
mavenCentral()
maven { url ‘JFrog’ }
maven { url ‘JFrog’ }
}
ext {
set(‘springCloudVersion’, “2020.0.3”)
}
dependencies {
implementation ‘org.springframework.boot:spring-boot-starter-actuator’
implementation ‘org.springframework.cloud:spring-cloud-config-server’
implementation ‘org.springframework.cloud:spring-cloud-starter-bootstrap’
testImplementation ‘org.springframework.boot:spring-boot-starter-test’
}
dependencyManagement {
imports {
mavenBom “org.springframework.cloud:spring-cloud-dependencies:${springCloudVersion}”
}
}
test {
useJUnitPlatform()
}
task copyJar(type: Copy) {
from jar // here it automatically reads jar file produced from jar task
into ‘…/…/dist’
}
build.dependsOn copyJar