기록용 블로그

[Spring] Could not resolve all files for configuration ':classpath'. 에러 본문

개발/Spring

[Spring] Could not resolve all files for configuration ':classpath'. 에러

andjane 2023. 3. 30. 23:41

 

Spring initializr의 도움을 받아 인텔리제이에서 프로젝트 설정을 하다 

빌드 도중 아래와 같은 에러가 났다.

A problem occurred configuring root project 'order-service'.
> Could not resolve all files for configuration ':classpath'.
   > Could not resolve org.springframework.boot:spring-boot-gradle-plugin:3.0.5.
     Required by:
         project : > org.springframework.boot:org.springframework.boot.gradle.plugin:3.0.5
      > No matching variant of org.springframework.boot:spring-boot-gradle-plugin:3.0.5 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.0.5 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.0.5 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.0.5 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.0.5 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.0.5 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.0.5 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')

 

 

 

확인해보니 Springboot 3.x 버전부터는 Gradle JVM이 17 이상이어야 했다.

필자는 springboot 3.0.5 버전을 받았는데, Gralde JVM 설정을 11로 설정해두어서 생긴 문제였다.

 

방법은 두가지

1. Springboot 버전을 다운그레이드 한다.

2. Gradle JVM 버전을 17이상으로 맞춰준다. 

 

나는 2번을 선택했다.

설정 방법은 Intelij 기준으로 

오른쪽 상단 File > Settings > Build, Execution, Deployment > Gradle > Gradle projects 에서

Gradle JVM을 17로 변경

 

재빌드 시 성공한 것을 확인할 수 있다.

'개발 > Spring' 카테고리의 다른 글

[Springboot] 스프링부트 프로젝트 초기 세팅하기  (0) 2023.03.31