inflearn logo
강의

강의

N
챌린지

챌린지

멘토링

멘토링

N
클립

클립

로드맵

로드맵

지식공유

./gradlew build FAIL

367

김주한

작성한 질문수 1

0

프로젝트 생성

프로젝트 Structure

 

빌드 command 입력시 오류내용

PS C:\Users\82107\spring\demo> ./gradlew build

FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring root project 'demo'.
> Could not resolve all files for configuration ':classpath'.
   > Could not resolve org.springframework.boot:spring-boot-gradle-plugin:3.2.3.
     Required by:
         project : > org.springframework.boot:org.springframework.boot.gradle.plugin:3.2.3
      > No matching variant of org.springframework.boot:spring-boot-gradle-plugin:3.2.3 was found. The consumer was configured to find a library for use during runtime, compatible with Java 8, packaged as a jar, and its dependencies declared externally, as well as attribute 'org.gradle.plugin.api-version' with value '8.6' but:
          - Variant 'apiElements' capability org.springframework.boot:spring-boot-gradle-plugin:3.2.3 declares a library, packaged as a jar, and its dependencies declared externally:
              - Incompatible because this component declares a component for use during compile-time, compatible with Java 17 and the consumer needed a component for use during runtime, compatible with Java 8
              - Other compatible attribute:
                  - Doesn't say anything about org.gradle.plugin.api-version (required '8.6')
          - Variant 'javadocElements' capability org.springframework.boot:spring-boot-gradle-plugin:3.2.3 declares a component for use during runtime, 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 8)
                  - Doesn't say anything about its elements (required them packaged as a jar)
                  - Doesn't say anything about org.gradle.plugin.api-version (required '8.6')
          - Variant 'mavenOptionalApiElements' capability org.springframework.boot:spring-boot-gradle-plugin-maven-optional:3.2.3 declares a library, packaged as a jar, and its dependencies declared externally:
              - Incompatible because this component declares a component for use during compile-time, compatible with Java 17 and the consumer needed a component for use during runtime, compatible with Java 8
              - Other compatible attribute:
                  - Doesn't say anything about org.gradle.plugin.api-version (required '8.6')
          - Variant 'mavenOptionalRuntimeElements' capability org.springframework.boot:spring-boot-gradle-plugin-maven-optional:3.2.3 declares a library for use during runtime, 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 8
              - Other compatible attribute:
                  - Doesn't say anything about org.gradle.plugin.api-version (required '8.6')
          - Variant 'runtimeElements' capability org.springframework.boot:spring-boot-gradle-plugin:3.2.3 declares a library for use during runtime, 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 8
              - Other compatible attribute:
                  - Doesn't say anything about org.gradle.plugin.api-version (required '8.6')
          - Variant 'sourcesElements' capability org.springframework.boot:spring-boot-gradle-plugin:3.2.3 declares a component for use during runtime, 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 8)
                  - Doesn't say anything about its elements (required them packaged as a jar)
                  - Doesn't say anything about org.gradle.plugin.api-version (required '8.6')

* Try:
> Review the variant matching algorithm at https://docs.gradle.org/8.6/userguide/variant_attributes.html#sec:abm_algorithm.
> No matching variant errors are explained in more detail at https://docs.gradle.org/8.6/userguide/variant_model.html#sub:variant-no-match.
> 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 2s

 

비슷한 질문들을 확인하였는데, 버전 문제인 것 같긴한데, 현재 JDK18버전을 사용하고 있어서 그런것인가요?

17버전으로 바꾸면 되나요? 만약에 그렇다고 한다면, 설정부분에서 어디어디를 바꿔주어야하나요?

spring intellij gradle

답변 1

0

인프런 AI 인턴

안녕하세요, 인프런 AI 인턴입니다.

김주한님, 빌드 오류는 프로젝트가 Java 8과 호환되는 라이브러리를 찾도록 설정되어있지만, 실제로는 Java 17과 호환되는 spring-boot-gradle-plugin:3.2.3을 필요로 하고 있기 때문에 발생하고 있습니다.

오류 메시지를 바탕으로 해결 방법을 제안 드리겠습니다.
- 프로젝트를 Java 17로 변경하거나
- spring-boot-gradle-plugin의 버전을 Java 8과 호환되는 버전으로 다운그레이드해야 합니다.

JDK 18을 사용 중이라면, 빌드 스크립트에서 JDK 버전을 17로 명시적으로 설정할 필요가 있습니다. build.gradle 파일과 IDE 설정에서 Java 버전을 JDK 17로 설정해 보세요.

build.gradle 파일에서는 다음과 같이 설정됩니다.

sourceCompatibility = '17'

IDE의 설정에서는 프로젝트의 JDK 버전을 17로 설정해야 합니다.

다음은 참고할 수 있는 관련 정보가 있는 문서와 URL입니다:
- Spring Boot Reference Documentation v3.1.5: Gradle 구성을 위한 기본 설정 (출처 링크)
- Spring Boot Gradle Plugin 요구 사항 (출처 링크)

변경 후 ./gradlew build 명령어를 다시 실행하여 문제가 해결되었는지 확인해 주세요.

안녕하세요 치킨 디도스 이벤트 보고 흉내내보려 들어왔습니다..

0

12

1

실무 내용 문의드려요

0

23

2

SingletonService가 JVM이 뜰 때 생성되는게 맞나요?

0

33

2

임포트 오류

0

34

2

답을언제쯤받아볼수있나요

0

49

2

형 책 어떻게 받아?

1

59

1

@JsonIgnore 이후 Internal Server Error가 발생하지 않습니다.

0

33

2

mvc 패턴 - 적용 강의에서 회원가입할 때 redirect가 아닌 forward인 이유가 궁금합니다.

0

29

1

프로젝트가 없어요..

0

56

2

JpaCursorItemReader의 정렬 조건 부재의 영향

1

46

2

소스코드 빈 파일 문의드려요

0

43

2

changeTeam 메서드 질문

0

35

1

"컴파일 시점에 없는 값을 어떻게 참조할 것인가?" 섹션

1

53

2

테스트 관련 질문!

0

55

2

handleBindException 의 기대의도가 방향이 맞는지 궁금합니다.

0

42

2

SpringBoot 4.0.6 버전에서 PackageLogTracePostProcessor exception

0

87

3

인텔리제이 오류

0

52

1

프로젝트 의존 관계

0

53

2

application.properties가 적용되지 않아요

1

69

3

새 프로젝트 속 제너레이터에 SpringBoot가 없습니다.

0

54

2

섹션3. 11 회원객체 다이어그램

0

37

1

OCP, DIP과 @Qualifier 어노테이션에 대해서 질문합니다.

0

36

1

강의 연장 요청

0

47

2

설정 정보 없이 임베디드 데이터베이스 생성

0

40

1