์ตœ๊ทผ 2๋…„์ •๋„ IntelliJ์—์„œ Java 11 ๊ธฐ๋ฐ˜์˜ AWS Correto 11 ์„ ์‚ฌ์šฉํ•ด์™”์Šต๋‹ˆ๋‹ค

๊ทธ๋ž˜์„œ ํ˜„์žฌ JAVA_HOME ์€ AWS Correto 11 ์˜ ์œ„์น˜๋ฅผ ๊ฐ€๋ฆฌํ‚ค๊ณ  ์žˆ์—ˆ์Šต๋‹ˆ๋‹ค.

์‹ ๊ทœ ํ”„๋กœ์ ํŠธ ๊ตฌ์„ฑํ•  ์ผ์ด ์ƒ๊ฒผ๊ณ 

AWS Correto 17 ์„ ๋ฏธ๋ฆฌ ๋‹ค์šด๋ฐ›์•„๋‘” ์ƒํƒœ์—์„œ

IntelliJ ์—์„œ SpringBoot Initializer ๋ฅผ ์ด์šฉํ•ด์„œ

์•„๋ž˜์™€ ๊ฐ™์€ ์„ค์ •(Java 17 + gradle groovy)์œผ๋กœ ํ”„๋กœ์ ํŠธ๋ฅผ ์ƒ์„ฑํ•˜๊ณ 

๋นŒ๋“œ๋ฅผ ํ•˜๋‹ˆ ์˜ค๋ฅ˜๊ฐ€ ๋ฐœ์ƒํ–ˆ์Šต๋‹ˆ๋‹ค.

์Šคํ”„๋ง๋ถ€ํŠธ ์‹ ๊ทœ ํ”„๋กœ์ ํŠธ ์ƒ์„ฑ ์„ค์ •ํ™”๋ฉด (Java 17 ์„ค์ •)

 

์•„๋ž˜๋Š” ๋นŒ๋“œ์‹œ ๋ฐœ์ƒํ–ˆ๋˜ ์˜ค๋ฅ˜ ๋ฉ”์‹œ์ง€

A problem occurred configuring root project 'my-new-springboot3-project'.
> Could not resolve all files for configuration ':classpath'.
   > Could not resolve org.springframework.boot:spring-boot-gradle-plugin:3.2.1.
     Required by:
         project : > org.springframework.boot:org.springframework.boot.gradle.plugin:3.2.1
      > No matching variant of org.springframework.boot:spring-boot-gradle-plugin:3.2.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.5' but:
          - Variant 'apiElements' capability org.springframework.boot:spring-boot-gradle-plugin:3.2.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.5')
          - Variant 'javadocElements' capability org.springframework.boot:spring-boot-gradle-plugin:3.2.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.5')
          - Variant 'mavenOptionalApiElements' capability org.springframework.boot:spring-boot-gradle-plugin-maven-optional:3.2.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.5')
          - Variant 'mavenOptionalRuntimeElements' capability org.springframework.boot:spring-boot-gradle-plugin-maven-optional:3.2.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.5')
          - Variant 'runtimeElements' capability org.springframework.boot:spring-boot-gradle-plugin:3.2.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.5')
          - Variant 'sourcesElements' capability org.springframework.boot:spring-boot-gradle-plugin:3.2.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.5')

* 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.
> Get more help at https://help.gradle.org.
BUILD FAILED in 1s

 

์—๋Ÿฌ ๋ฉ”์‹œ์ง€์˜ ๋‚ด์šฉ์„ ์ฝ์–ด๋ณด๋‹ˆ, ์ผ๋‹จ Could not resolve xxx ์˜ ๊ฒฝ์šฐ xxx ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ๊ฐ€ ์—†๋‹ค๋ผ๋Š” ๋ฉ”์‹œ์ง€์ธ๋ฐ

์‹ ๊ทœ ์ƒ์„ฑํ•œ ํ”„๋กœ์ ํŠธ์—์„œ ํ•„์ˆ˜๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ๋ฅผ dependency์— ์•ˆ๋„ฃ์„ ์ด์œ ๊ฐ€ ์—†๋‹ค๋Š” ์ƒ๊ฐ์ด ์šฐ์„  ๋“ค์—ˆ์Šต๋‹ˆ๋‹ค.

๊ทธ๋Ÿฐ๊ฑฐ๋ผ๋ฉด springboot initializer ์˜ ๋ฒ„๊ทธ์ผํ…Œ๋‹ˆ๊นŒ์š”.

๊ทธ๋ž˜์„œ ๋” ์ฝ์–ด๋ดค์Šต๋‹ˆ๋‹ค.

๊ทธ๋ฆฌ๊ณ  "requierd compatibility with Java 11" ๋ฌธ๊ตฌ๊ฐ€ ๋ˆˆ์— ๋„์—ˆ์Šต๋‹ˆ๋‹ค.

๋‚œ ์ž๋ฐ”17์„ ์“ฐ๋ ค๊ณ  17๋ฒ„์ „์œผ๋กœ JDK์™€ Java ์„ค์ •์„ ๋„ฃ์—ˆ๋Š”๋ฐ ์™œ Java 11 ๊ด€๋ จ๋ฉ”์‹œ์ง€๊ฐ€ ๋œจ๋Š”๊ฑด์ง€ ์ด์ƒํ–ˆ์Šต๋‹ˆ๋‹ค. ๐Ÿค”

์—๋Ÿฌ๋ฉ”์‹œ์ง€ ๋‚ด์šฉ์œผ๋กœ ๊ตฌ๊ธ€๋ง์„ ์ข€ ํ•ด๋ณด๋‹ˆ ์•„๋ž˜ ๋ถ€๋ถ„๋“ค์„ ํ™•์ธํ•ด๋ณด๋ผ๋Š” ๋‚ด์šฉ๋“ค์ด ์žˆ์—ˆ์Šต๋‹ˆ๋‹ค.

  • ํ˜„์žฌ ์‹œ์Šคํ…œ์—์„œ ์‚ฌ์šฉํ•˜๋Š” Java ๋ฒ„์ „ ํ™•์ธ (java -version)
  • build.gradle ํŒŒ์ผ์˜  sourceCompatibility ํ™•์ธ
  • IntelliJ ์˜ project SDK ์„ค์ • ํ™•์ธ
  • gradle JVM ์„ค์ • ํ™•์ธ

์ผ๋‹จ ๋นŒ๋“œ์‹œ์— ๋ฐœ์ƒํ–ˆ๊ณ , ๋นŒ๋“œํˆด์€ gradle ์ด๋ผ๋Š” ๊ฑธ ์ด๋ฏธ ํ”„๋กœ์ ํŠธ ์ƒ์„ฑ์‹œ ์„ค์ •์„ ํ•ด์ฃผ์—ˆ๊ณ , IntelliJ์— gradle ์ด ์‚ฌ์šฉํ•  ์ž๋ฐ”๋ฒ„์ „์„ ์„ค์ •ํ•˜๋Š” ๋‚ด์šฉ์ด ์žˆ๋‹ค๋Š” ๊ฒƒ์„ ์•Œ๊ณ ์žˆ์—ˆ๊ธฐ์— gradle JVM ์„ค์ •์„ ๋จผ์ € ํ™•์ธํ•ด๋ดค์Šต๋‹ˆ๋‹ค.

gradle JVM ์„ค์ •์ด ๊ธฐ์กด ์„ค์ • ๊ทธ๋Œ€๋กœ Java 11์„ ์‚ฌ์šฉํ•˜๋„๋ก ๋˜์–ด์žˆ์—ˆ์Šต๋‹ˆ๋‹ค. ๐Ÿ˜ญ

ํ”„๋กœ์ ํŠธ ์ƒ์„ฑ์‹œ correto 17, Java 17 ๋ฒ„์ „์„ ์„ค์ •ํ•ด์ฃผ์—ˆ๊ธฐ์— sourceCompatibility ์™€ project SDK ๋Š” 17๋ฒ„์ „์„ ์‚ฌ์šฉํ•˜๋„๋ก ๋˜์–ด์žˆ์—ˆ๊ณ , JAVA_HOME์— ์„ค์ •๋˜์–ด์žˆ๋Š” ํ˜„์žฌ ์‹œ์Šคํ…œ์—์„œ ๊ธฐ๋ณธ์œผ๋กœ ์‚ฌ์šฉ์ค‘์ธ Java ๋ฒ„์ „๊ณผ๋Š” ๊ด€๊ณ„๊ฐ€ ์—†์—ˆ์Šต๋‹ˆ๋‹ค.

 

gradle JVM ์„ค์ • ํ™•์ธ ๋ฐฉ๋ฒ•

Preferences/Settings (โŒ˜ + , ) > Build, Execution, Deployment > Build Tools > Gradle

Gradle JVM ์„ค์ • ํ™”๋ฉด

project SDK ์„ค์ • ํ™•์ธ ๋ฐฉ๋ฒ•

File > Project Structure.. (โŒ˜ + ; )

Project SDK ์„ค์ • ํ™”๋ฉด

build.gradle ํŒŒ์ผ์˜ sourceCompatibility ํ™•์ธ ๋ฐฉ๋ฒ•

build.gradle ํŒŒ์ผ์—์„œ sourceCompatibility ์„ค์ • ๋ฐฉ๋ฒ•