1. java 설치
- jdk 17 버전 다운
- https://www.oracle.com/java/technologies/javase/jdk17-archive-downloads.html
- spring boot 3.0 부터는 java 17 버전부터 지원 됨.
2. 환경변수 셋팅
- 이거는 반드시 할 필요는 없음 (여러 jdk 버전을 사용할 경우)
3. vs code - extension 설치
- Extension Pack for Java
- Spring Boot Tools
- Spring Initializr Java Support
- Gradle for Java
- spring boot dashboard
4. spring initializr (https://start.spring.io/) 접속 후 상세 설정 후에 압축파일을 받아서 vscode에서 염
5. 4를 진행한 후 vs code 에서 프로젝트를 연 다음, 터미널에서 명령어 입력
./gradlew
6. spring boot dashboard 에서 apps 실행
* port 변경이 필요한 경우 application.properties 파일에서
server.port=8081 // 추가해준다.
// gradle 오류가 날 경우, (java version error ; java home 을 잘못 찾는 경우)
Could not run phased build action using connection to Gradle distribution 'https://services.gradle.org/distributions/gradle-8.7-bin.zip'.
org.gradle.api.ProjectConfigurationException: A problem occurred configuring root project 'test'.
A problem occurred configuring root project 'test'.
Could not resolve all artifacts for configuration ':classpath'.
Could not resolve org.springframework.boot:spring-boot-gradle-plugin:3.2.5.
Required by:
project : > org.springframework.boot:org.springframework.boot.gradle.plugin:3.2.5
No matching variant of org.springframework.boot:spring-boot-gradle-plugin:3.2.5 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.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 8
- 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 8)
- 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 8
- 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 8
- Other compatible attribute:
- Doesn't say anything about org.gradle.plugin.api-version (required '8.7')
- Variant 'runtimeElements' 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.7')
- 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 8)
- Doesn't say anything about org.gradle.plugin.api-version (required '8.7')
// vs code > settings.json 에서 아래 값을 추가해준다.
{
...
"java.import.gradle.java.home": "C:\\Program Files\\Java\\jdk-17.0.10"
...
}
'DevTools' 카테고리의 다른 글
Eclipse 에서 Tomcat 다중 프로젝트 설정하는 방법 (0) | 2024.07.02 |
---|---|
[VS CODE] 여러 개의 java version 사용 (0) | 2024.05.21 |
Visual Studio Code 단축키 정리 (1) | 2024.03.14 |
[DBeaver] 테이블 데이터 복사 (0) | 2023.09.13 |
STS (SpringSource Tool Suite) (0) | 2023.08.16 |