본문 바로가기

서버

SpringBoot - vscode에서 열 때 gradle 버전오류 생기는 현상

728x90
Could not install Gradle distribution from 'https://services.gradle.org/distributions/gradle-4.6-bin.zip'

 

이러한 오류가 발생하였다. 

 

Gradle 프로젝트로된 스프링부트는 의존성을 다음과 같이 가져옴

 

1. 로컬 gradle 설치되면 gradle 이용해 가져옴

2. 없으면 셋팅된 java로 gradle/wrapper/gradle-wrapper.properties를 보고 설정된 버전의 gradle zip파일을 가져옴

 

 

해당 에러는 java버전이 gradle 버전과 맞지 않아서 생긴 이슈다. 

 

에디터에서 java버전을 셋팅해놓는 경우가 있는데 

호스트의 java버전과 맞게 gradle을 가져오려면 다음과 같은 파일을 추가하면 된다.

 

 

[gradle.properties]

org.gradle.java.home=본인자바설치경로



프로젝트 루트 경로에 넣어주면 된다.

 

이렇게 한 뒤 

다시 프로젝트를 빌드하면 gradle.properties를 먼저 스캔하여 java path에서 gradle을 땡겨오는 명령어를 실행한다.