작성
·
1.2K
0
[질문 템플릿]
1. 강의 내용과 관련된 질문인가요? 예
2. 인프런의 질문 게시판과 자주 하는 질문에 없는 내용인가요? 예
3. 질문 잘하기 메뉴얼을 읽어보셨나요? 예
[질문 내용]
./gradlew clean build를 했을 때 아래와 같은 에러가 발생합니다.
구글 드라이브 링크: https://drive.google.com/file/d/1noPIwH5K_JrQ_st4-VSuOOqVLuLBopJw/view?usp=sharing
$ ./gradlew clean build
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring root project 'jpashop'.
> Could not resolve all files for configuration ':classpath'.
> Could not resolve org.springframework.boot:spring-boot-gradle-plugin:3.1.0.
Required by:
project : > org.springframework.boot:org.springframework.boot.gradle.plugin:3.1.0
> No matching variant of org.springframework.boot:spring-boot-gradle-plugin:3.1.0 was found. The consumer was configured to find a runtime of a library compatible with Java 11, packaged as a jar, and its dependencies declared externally, as well as attribute 'org.gradle.plugin.api-version' with value '7.6.1' but:
- Variant 'apiElements' capability org.springframework.boot:spring-boot-gradle-plugin:3.1.0 declares a library, packaged as a jar, and its dependencies declared externally:
- Incompatible because this component declares an API of a component compatible with Java 17 and the consumer needed a runtime of a component compatible with Java 11
- Other compatible attribute:
- Doesn't say anything about org.gradle.plugin.api-version (required '7.6.1')
- Variant 'javadocElements' capability org.springframework.boot:spring-boot-gradle-plugin:3.1.0 declares a runtime of a component, and its dependencies declared externally:
- Incompatible because this component declares documentation and the consumer needed a library
- Other compatible attributes:
- Doesn't say anything about its target Java version (required compatibility with Java 11)
- Doesn't say anything about its elements (required them packaged as a jar)
- Doesn't say anything about org.gradle.plugin.api-version (required '7.6.1')
- Variant 'mavenOptionalApiElements' capability org.springframework.boot:spring-boot-gradle-plugin-maven-optional:3.1.0 declares a library, packaged as a jar, and its dependencies declared externally:
- Incompatible because this component declares an API of a component compatible with Java 17 and the consumer needed a runtime of a component compatible with Java 11
- Other compatible attribute:
- Doesn't say anything about org.gradle.plugin.api-version (required '7.6.1')
- Variant 'mavenOptionalRuntimeElements' capability org.springframework.boot:spring-boot-gradle-plugin-maven-optional:3.1.0 declares a runtime of a library, packaged as a jar, and its dependencies declared externally:
- Incompatible because this component declares a component compatible with Java 17 and the consumer needed a component compatible with Java 11
- Other compatible attribute:
- Doesn't say anything about org.gradle.plugin.api-version (required '7.6.1')
- Variant 'runtimeElements' capability org.springframework.boot:spring-boot-gradle-plugin:3.1.0 declares a runtime of a library, packaged as a jar, and its dependencies declared externally:
- Incompatible because this component declares a component compatible with Java 17 and the consumer needed a component compatible with Java 11
- Other compatible attribute:
- Doesn't say anything about org.gradle.plugin.api-version (required '7.6.1')
- Variant 'sourcesElements' capability org.springframework.boot:spring-boot-gradle-plugin:3.1.0 declares a runtime of a component, and its dependencies declared externally:
- Incompatible because this component declares documentation and the consumer needed a library
- Other compatible attributes:
- Doesn't say anything about its target Java version (required compatibility with Java 11)
- Doesn't say anything about its elements (required them packaged as a jar)
- Doesn't say anything about org.gradle.plugin.api-version (required '7.6.1')
* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 4s
답변 3
0
안녕하세요, 인프런 AI 인턴이에요.
에러 대해서 먼저 간단하게 설명 드릴게요.
해당 에러는 프로젝트에서 사용하고 있는 Spring Boot의 버전과 Gradle 버전이 호환되지 않아 발생하는 에러입니다.
해결 방법으로는 두 가지가 있습니다.
1. 프로젝트에서 사용하는 Spring Boot 버전을 Gradle 버전에 맞춰 변경해주는 것입니다.
2. 현재 사용중인 Gradle 버전을 Spring Boot 버전에 맞춰 업그레이드 하는 것입니다.
2번 방법을 사용할 경우 아래와 같이 Gradle 설정 파일(build.gradle)을 수정해주셔야 합니다.
build.gradle 파일에서 다음과 같은 내용을 찾아서 수정해주세요.
classpath("org.springframework.boot:spring-boot-gradle-plugin:3.1.0")
위 내용을 아래와 같이 수정해주세요.
classpath("org.springframework.boot:spring-boot-gradle-plugin:2.6.3")
이후, 다시 ./gradlew clean build
명령어를 실행해보시면 정상적으로 빌드가 진행될 것입니다.
어려운 문제였을텐데, 제가 도움이 될 수 있어서 좋았습니다. 이용해주셔서 감사합니다.
-1
보여주신 부분은 IDE에서의 JDK 설정입니다 :)
질문에서 보여주신 것처럼 터미널에서 gradle 명령어를 사용하고자 하신다면 환경변수 설정이 필요합니다.