build.gradle 파일을 빌드하려고 하니 에러가 발생함
코드
plugins {
id 'org.springframework.boot' version '2.7.2'
id 'io.spring.dependency-management' version '1.0.12.RELEASE'
id 'java'
}
에러 내용
Plugin [id: 'org.springframework.boot', version: '2.7.2'] 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.2'] 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.2')
라는 에러 발생
에러 해결 방법은
buildscript {
repositories {
mavenLocal()
maven { url 'https://maven.aliyun.com/repository/google/' }
maven { url 'https://maven.aliyun.com/repository/public/' }
maven { url 'https://maven.aliyun.com/repository/spring/' }
maven { url 'https://maven.aliyun.com/repository/gradle-plugin/' }
maven { url 'https://maven.aliyun.com/repository/spring-plugin/' }
maven {
url "https://plugins.gradle.org/m2/"
}
mavenCentral()
}
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:2.7.2")
classpath "io.spring.gradle:dependency-management-plugin:1.0.12.RELEASE"
}
}
plugins {
id 'java'
}
apply plugin: "org.springframework.boot"
apply plugin: "io.spring.dependency-management"
로 변경하고 빌드하면 정상적으로 빌드 됨.