티스토리 뷰

개인 / 사이드 프로젝트를 진행할 때는 별생각 없이 Spring initializr의 도움을 받곤 한다

Springboot, Gradle의 버전을 딱히 신경 쓰고 있지 않다는 뜻이다

https://start.spring.io

 

 

인프런에서 Spring Cloud 강의를 듣고 있던 중 Netflix Zuul 실습 과정이 있는데 이를 위해서 스프링 부트의 버전을 변경해야 한다

2.3.x 버전이 필요한데 initializr 에서는 2.4.x 까지만 적용이 가능하고 2.3.x은 바로 사용할 수가 없었다

별생각 없이 plugins {...}에서만 버전을 고쳐 빌드를 해보았는데 
plugin org.springframework.boot was not found in any of the following sources exception' 에러가 날 맞아주었다

 

 

구글링 도중 한줄기 빛을 찾았고 적용했다

https://www.bswen.com/2020/11/java-How-to-solve-springboot-exception-3.html

 

java-How to solve ‘plugin org.springframework.boot was not found in any of the following sources exception’ when building sp

Java Web Android iOS Python Frameworks Spring Maven programming

www.bswen.com

 

 

buildscript {...}를 plugins {...}보다 앞에 두어야 제대로 빌드가 이루어진다

또한 start.spring.io를 이용해 프로젝트를 생성한다면 기본적으로 plugins {...} 아래에

id 'org.springframework.boot' version '2.5.3' 와 같이 되어 있는데

id 'org.springframework.boot' version '2.3.8.RELEASE' 로 버전을 변경해주고 RELEASE까지 붙여줘야 정상적으로 빌드된다

// 요기 추가
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/' }

        mavenCentral()
    }
    dependencies {
        classpath("org.springframework.boot:spring-boot-gradle-plugin:2.3.8.RELEASE")
    }
}

plugins {
    //RELEASE 추가해주기
    id 'org.springframework.boot' version '2.3.8.RELEASE'
    id 'io.spring.dependency-management' version '1.0.8.RELEASE'
    id 'java'
}

 

 

2.3.8 빌드가 된 후 들뜬 마음으로 실행시켰더니 또 하나의 에러를 만났다

Spring Cloud Release 버전과 내가 설정한 버전이 맞지 않아서 나는 오류 같은데

이건 사실 별거 없고 부트가 알려주는 대로 application.properties 혹은 application.yml 파일에 라인만 추가해주면 된다

 

 

혹은 스프링부트 2.3.8 버전에 맞는 Spring Cloud 버전을 올바르게 설정해주면 된다

Spring Cloud 실습으로 Hello World 수준만 진행하고 있기 때문에 문제가 생기지 않는 이상 그냥 돌려도 될 것 같다

추후 실습 과정에서 문제가 생길 경우 공식 사이트를 참조하여 Spring Cloud 버전을 알맞게 명시해주자

https://spring.io/projects/spring-cloud#overview

 

Spring Cloud

Spring Cloud is an umbrella project consisting of independent projects with, in principle, different release cadences. To manage the portfolio a BOM (Bill of Materials) is published with a curated set of dependencies on the individual project. Go here to r

spring.io

 

댓글
링크
글 보관함
«   2024/04   »
1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29 30
Total
Today
Yesterday