인프런 커뮤니티 질문&답변

박호정님의 프로필 이미지

작성한 질문수

자바와 스프링 부트로 생애 최초 서버 만들기, 누구나 쉽게 개발부터 배포까지! [서버 개발 올인원 패키지]

강의 준비 영상 - 스프링 프로젝트를 시작하는 첫 번째 방법

스프링 부트 3.0.1 자바 버전 호환성

해결된 질문

23.12.19 16:27 작성

·

540

·

수정됨

1

A problem occurred configuring root project 'library-app'.
> Could not resolve all files for configuration ':classpath'.
   > Could not resolve org.springframework.boot:spring-boot-gradle-plugin:3.0.1.
     Required by:
         project : > org.springframework.boot:org.springframework.boot.gradle.plugin:3.0.1
      > No matching variant of org.springframework.boot:spring-boot-gradle-plugin:3.0.1 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.5' but:
          - Variant 'apiElements' capability org.springframework.boot:spring-boot-gradle-plugin:3.0.1 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.5')
          - Variant 'javadocElements' capability org.springframework.boot:spring-boot-gradle-plugin:3.0.1 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.5')
          - Variant 'mavenOptionalApiElements' capability org.springframework.boot:spring-boot-gradle-plugin-maven-optional:3.0.1 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.5')
          - Variant 'mavenOptionalRuntimeElements' capability org.springframework.boot:spring-boot-gradle-plugin-maven-optional:3.0.1 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.5')
          - Variant 'runtimeElements' capability org.springframework.boot:spring-boot-gradle-plugin:3.0.1 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.5')
          - Variant 'sourcesElements' capability org.springframework.boot:spring-boot-gradle-plugin:3.0.1 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.5')

* 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.


수업자료로 제공되는 압축파일을 받았는데요. jdk 11 설치 후 gradle sync를 누르면 위와 같은 에러가 나오는데요. 강의 설명에서는 11을 깔라고 하셔서 진행하는데 잘 안되네요.

build.gradle 파일에 다음과 같이 선언되어 있는데, 스프링부트 3.0.1 버전에서는 17이 호환되는 거 같아서 질문드립니다. jdk 17깔고 설정하니 gradle install은 잘 되네요.
```
plugins { id 'org.springframework.boot' version '3.0.1' id 'io.spring.dependency-management' version '1.0.12.RELEASE' id 'java' }
```


답변 1

1

최태현님의 프로필 이미지
최태현
지식공유자

2023. 12. 19. 20:18

안녕하세요 호정님! 질문 올려주셔서 감사합니다!! 🙂

혹시 "최종 완성 버전"을 다운로드 하신건 아닌가 싶습니다!!!

현재 압축 파일을 두 개 제공해 드리고 있는데요~

  • 처음 시작하기 위한 용도

    • spring 2.7.x 버전 + Java 11 버전

  • 최종 완성본 코드 비교 용도

    • spring 3.0.x 버전 + Java 17 버전

이렇게 두 가지 입니다!

만약 후자를 다운로드 받으셨다면, spring 3.0.x 버전의 최소 Java 버전이 17버전이기 때문에 JDK 17을 잘 설치 해주신게 맞습니다!!

답변이 도움이 되었다면 좋겠습니다~ 감사합니다!!! 🙏

박호정님의 프로필 이미지
박호정
질문자

2023. 12. 19. 22:05

아 두개가 제공되는 줄 몰랐네요. 최종본을 받아서 실행을 했습니다. 후자는 jdk 17로 돌아가는 것을 확인했는데요.

17버전으로 start.spring.io에서 받은 후에 에러 나는거 고쳐서 우선 세팅은 진행해서 하고 있었는데, 올려주신 다른 압축파일을 이용하도록 하겠습니다 답변감사합니다!

박호정님의 프로필 이미지
박호정
질문자

2023. 12. 19. 22:13



상황을 설명드리면, 강의 소개에서 ppt와 코드가 제공된다고 본 상태였어서 첫번째 강의 자료는 ppt, 두번째 강의자료는 코드인 것으로 생각을 했네요.

강의 제목이 각각 다음처럼 되어 있으면, 저와 같은 실수 하시는 분이 줄어들 거 같네요! 강의 잘 보고 있습니다~
-강의자료 (처음 시작하기 위한 코드)
-강의자료 (최종 완성본 코드)

최태현님의 프로필 이미지
최태현
지식공유자

2023. 12. 21. 10:41

안녕하세요 호정님!!! 오오오 정말 좋은 의견 감사합니다!

image미처 생각하지 못했던 부분이네요! 감사합니다 😊 빠르게 반영해두었습니다. 오늘도 좋은 하루 되세요!! 🙏