Spring Initializr 로 생성한 프로젝트를 인텔리제이에서 열었더니 에러.. (Could not resolve all artifacts for configuration ':classpath'.)

FreeZeeSun·2024년 5월 29일
0

에러일기

목록 보기
8/9

spring initializr 에서 생성

https://start.spring.io/

  • Project : Gradle - Groovy

  • Language : Java

  • Spring Boot : 3.3.0

  • Packaging : jar

  • Java : 17

  • Dependencies : Lombok Spring Web Mustache Spring Security MySQL Driver Spring Data JPA

plugins {
  id 'java'
  id 'org.springframework.boot' version '3.3.0'
  id 'io.spring.dependency-management' version '1.1.5'
}

group = 'com.example'
version = '0.0.1-SNAPSHOT'

java {
  sourceCompatibility = '17'
}

configurations {
  compileOnly {
    extendsFrom annotationProcessor
  }
}

repositories {
  mavenCentral()
}

dependencies {
  implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
  implementation 'org.springframework.boot:spring-boot-starter-mustache'
  implementation 'org.springframework.boot:spring-boot-starter-security'
  implementation 'org.springframework.boot:spring-boot-starter-web'
  compileOnly 'org.projectlombok:lombok'
  runtimeOnly 'com.mysql:mysql-connector-j'
  annotationProcessor 'org.projectlombok:lombok'
  testImplementation 'org.springframework.boot:spring-boot-starter-test'
  testImplementation 'org.springframework.security:spring-security-test'
  testRuntimeOnly 'org.junit.platform:junit-platform-launcher'
}

tasks.named('test') {
  useJUnitPlatform()
}

이렇게 만든 스프링 프로젝트를 다운로드.
zip 파일을 압축해제 해주었다.

IdeaProjects 폴더에 이동

인텔리제이에서 관리하는 폴더 위치이다.

인텔리제이에서 프로젝트 열기

쎄한... 첫 인상...^^

그냥 open 만 했을 뿐인데 반겨주는 에러메시지를 확인해보겠다..

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

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

한마디로, 내가 기존에 설치해놓은 JDK 및 Java 및 gradle 버전과 호환되지 않는다는 거다.
그도 그럴게, 내가 강의에 맞춰서 미리 세팅해놓은건 없다.
난 그냥.. 다 자동으로 되는 줄 알았다..
인텔리제이에서 extension을 깔았으므로...ㅠ.ㅠ

Settings 에서 확인

File > Settings > Build, Execution, Deployment > Build Tools > Gradle 에서
Gradle JVM 을 보니 JAVA_HOME 11.0.11 로 되어있었다...
난 분명 저번에 openJDK corretto-18을 깔았던 기억이 있다....
그렇다면, JDK 17 버전을 다운로드 해보겠다.

빌드 성공

빌드 성공한 버전 확인

java 17
jdk 17.0.11
springframework.boot 3.3.0
gradle 8.7

profile
개발자 지망생. 지금은 삽질의 연속, 하지만 언젠가는 삽질이 아닐 것이기에!

0개의 댓글