본문 바로가기

개발 환경/환경 설정

스프링 부트 환경설정(인텔리제이.ver)

1. 스프링 부트 설정파일 다운로드

https://start.spring.io/ 접속하여 설정 정보 입력 > ADD DEPENDENCIES > GENERGENERATEATE

 

Aritifact 에 프로젝트명을 입력하면 Name에도 동일하게 자동적용된다.

 

 

2. 스프링 부트 설정파일 import

1) 원하는 위치에 다운받은 zip 파일 압축을푼다.

2) File > Open > 압축 푼 폴더 > build.gradle 파일 오픈

3) 빌드 기다리기

 

3. 에러 수정

빌드가 되지 않고 아래와 같은 에러들이 발생했다. 해결해보자.

A problem occurred configuring root project 'todoList'.
> Could not resolve all files for configuration ':classpath'.
   > Could not resolve org.springframework.boot:spring-boot-gradle-plugin:3.0.3.
     Required by:
         project : > org.springframework.boot:org.springframework.boot.gradle.plugin:3.0.3
      > No matching variant of org.springframework.boot:spring-boot-gradle-plugin:3.0.3 was found. The consumer was configured to find a runtime of a library compatible with Java 8, packaged as a jar, and its dependencies declared externally, as well as attribute 'org.gradle.plugin.api-version' with value '7.6' but:
          - Variant 'apiElements' capability org.springframework.boot:spring-boot-gradle-plugin:3.0.3 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 8
              - Other compatible attribute:
                  - Doesn't say anything about org.gradle.plugin.api-version (required '7.6')
          - Variant 'javadocElements' capability org.springframework.boot:spring-boot-gradle-plugin:3.0.3 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 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 '7.6')
          - Variant 'mavenOptionalApiElements' capability org.springframework.boot:spring-boot-gradle-plugin-maven-optional:3.0.3 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 8
              - Other compatible attribute:
                  - Doesn't say anything about org.gradle.plugin.api-version (required '7.6')
          - Variant 'mavenOptionalRuntimeElements' capability org.springframework.boot:spring-boot-gradle-plugin-maven-optional:3.0.3 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 8
              - Other compatible attribute:
                  - Doesn't say anything about org.gradle.plugin.api-version (required '7.6')
          - Variant 'runtimeElements' capability org.springframework.boot:spring-boot-gradle-plugin:3.0.3 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 8
              - Other compatible attribute:
                  - Doesn't say anything about org.gradle.plugin.api-version (required '7.6')
          - Variant 'sourcesElements' capability org.springframework.boot:spring-boot-gradle-plugin:3.0.3 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 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 '7.6')

* Try:
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.

구글링으로 찾아보니 spring boot 가 3.0.0 버전 이후부터는 java 17 버전이 필요하다는 것을 알게 되었다.

 

1) 자바 17버전을 다운받고 실행 파일을 통해 설치한다.

Java Archive Downloads - Java SE 17 (oracle.com)

 

Java Archive Downloads - Java SE 17

WARNING: These older versions of the JDK are provided to help developers debug issues in older systems. They are not updated with the latest security patches and are not recommended for use in production. For production use Oracle recommends downloading th

www.oracle.com

2) 설치 후에 cmd로 java -version 을 입력해서 제대로 설치되었는지 확인한다.

 

3) 이제 인텔리제이로 가서 자바 버전을 17로 변경한다. 과정은 아래를 참고한다.

 

https://jojoldu.tistory.com/698

 

Spring Boot 3.x 실행이 안될 경우 (feat. IntelliJ)

스프링 부트 3.0 이 출시되었다. (현재 최신은 3.0.1 이지만) 3.0 부터는 Java 17부터 지원된다. 그러다보니 기존에 Java8, 11등을 사용하시던 분들은 3.x 스프링 부트 프로젝트를 실행할때 에러들을 만나

jojoldu.tistory.com

 

잘 빌드되었다.

4. 환경설정 확인

1) src > main > java 에 이미 존재하는 java 파일 Run

2) localhost:8080 으로 접속하면 아래와 같은 에러 페이지 발생

3) 아래 이미지처럼 뜨면 환경설정이 완료된 것이다.

'개발 환경 > 환경 설정' 카테고리의 다른 글

이클립스 설치 방법  (0) 2022.08.10