๊ธฐ์กด์ Java 11๋ก ๊ฐ๋ฐ์ ์งํํ์๋ค.
SpringBoot 3.1.1 ๋ฒ์ ์ผ๋ก ํ๋ก์ ํธ๋ฅผ ์์ฑํ๋ฉด์ ์๋ฐ ๋ฒ์ ์ถฉ๋์ด ๋ฌ๋ค.
SpringBoot 3.0๋ถํฐ๋ Spring Framework 6 ๋ฒ์ ์ ์ฌ์ฉํ๋ค.
๊ณต์๋ฌธ์์ ๋ฐ๋ฅด๋ฉด Spring 6๋ถํฐ๋ Java 17๋ง์ ์ง์ํ๊ธฐ ๋๋ฌธ์ ์๋ฐ 17 ์๋๋ฒ์ ์ธ ๊ฒฝ์ฐ ํ๋ก์ ํธ๋ฅผ ๋น๋ํ ์ ์๋ค.
https://spring.io/blog/2022/11/16/spring-framework-6-0-goes-ga
# build.gradle ์ค์
plugins {
id 'java'
id 'org.springframework.boot' version '3.1.1'
id 'io.spring.dependency-management' version '1.1.0'
}
group = 'com.juno'
java {
sourceCompatibility = '17'
}
repositories {
mavenCentral()
}
dependencies {
implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
implementation 'org.springframework.boot:spring-boot-starter-web'
developmentOnly 'org.springframework.boot:spring-boot-devtools'
runtimeOnly 'com.h2database:h2'
runtimeOnly 'com.mysql:mysql-connector-j'
testImplementation 'org.springframework.boot:spring-boot-starter-test'
}
tasks.named('test') {
useJUnitPlatform()
}
gradle๋ก build๋ฅผ ์๋ํ๋ฉด ๋ค์๊ณผ ๊ฐ์ ์ค๋ฅ๊ฐ ๋ฐ์ํ๋ฉด์ ๋น๋๊ฐ ์๋๋ค.
A problem occurred configuring root project 'todoary'.
> Could not resolve all files for configuration ':classpath'.
> Could not resolve org.springframework.boot:spring-boot-gradle-plugin:3.1.1.
Required by:
project : > org.springframework.boot:org.springframework.boot.gradle.plugin:3.1.1
> No matching variant of org.springframework.boot:spring-boot-gradle-plugin:3.1.1 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.1.1' but:
- Variant 'apiElements' capability org.springframework.boot:spring-boot-gradle-plugin:3.1.1 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.1.1')
- Variant 'javadocElements' capability org.springframework.boot:spring-boot-gradle-plugin:3.1.1 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 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 '8.1.1')
- Variant 'mavenOptionalApiElements' capability org.springframework.boot:spring-boot-gradle-plugin-maven-optional:3.1.1 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.1.1')
- Variant 'mavenOptionalRuntimeElements' capability org.springframework.boot:spring-boot-gradle-plugin-maven-optional:3.1.1 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.1.1')
- Variant 'runtimeElements' capability org.springframework.boot:spring-boot-gradle-plugin:3.1.1 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.1.1')
- Variant 'sourcesElements' capability org.springframework.boot:spring-boot-gradle-plugin:3.1.1 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 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 '8.1.1')
* 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.
์ธํ ๋ฆฌ์ ์ด ์ค์ ์์ Settings - Build, Execution, Deployment - Build Tools - Gradle ์ค์ ์ ํ์ธํด๋ณด๋ฉด Gradle JVM ๋ฒ์ ์ด ๋ง์ง ์์์ ํ์ธํ ์ ์๋ค.
Gradle JVM ๋ฒ์ ์ 17๋ก ์ฌ๋ ค์ค๋ค Gradle Build๋ฅผ ํด์ฃผ๋ฉด ๋ฌด์ฌํ ํ๋๋ฅผ ์๋ฃํ ์ ์๋ค.