10
02

์—๋Ÿฌ ๋ฐฐ๊ฒฝ

Execution failed for task ':domain:compileKotlin'.
> 'compileJava' task (current target is 1.8) and 'compileKotlin' task (current target is 17) jvm target compatibility should be set to the same Java version.
  Consider using JVM toolchain: https://kotl.in/gradle/jvm/toolchain

* 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.

 

๋ฉ€ํ‹ฐ๋ชจ๋“ˆ ๋„์ž…์ค‘ domain๋ ˆ์ด์–ด๋ฅผ Java, Kotlin Library๋กœ ๋งŒ๋“ค์—ˆ๋Š”๋ฐ compileJava์™€ compileKotlin์˜ ๋ฒ„์ „ ์ฐจ์ด๊ฐ€ ๋‚œ๋‹ค๋Š” ์˜ค๋ฅ˜๊ฐ€ ๋‚˜์™”๋‹ค.

์ฒ˜์Œ์—๋Š” domain์˜ ๋นŒ๋“œ ํŒŒ์ผ์—์„œ java๊ฐ€ 1_7๋กœ ๋ผ์žˆ๊ธธ๋ž˜ 1_8๋กœ ๋ฐ”๊ฟ”์คฌ๋Š”๋ฐ๋„ ์œ„ ์˜ค๋ฅ˜๊ฐ€ ๊ณ„์† ๋‚˜์™”๋‹ค.

java {
    sourceCompatibility = JavaVersion.VERSION_1_8
    targetCompatibility = JavaVersion.VERSION_1_8
}

๋ฌธ์ œ๋Š” kotlin ์ชฝ์ด๋‹ค.

kotlinOptions {
        jvmTarget = '1.8'
    }
 

JDK 1.1๋ฒ„์ „๋ถ€ํ„ฐ๋Š” 1.๋ฅผ ๋ถ™์ด์ง€์•Š๊ณ  ์„œ๋ธŒ๋ฒ„์ „ํ‘œ์‹œ๋ฅผ ํ•˜๋Š”๋ฐ ์ € ๋ฉ”์‹œ์ง€์— ๋”ฐ๋ผ ํ˜„์žฌ ๋ฒ„์ „์ธ 17๋กœ ๋ฐ”๊ฟ”์ฃผ๋ฉด ๋œ๋‹ค.

compileOptions {
        sourceCompatibility JavaVersion.VERSION_17
        targetCompatibility JavaVersion.VERSION_17
    }
kotlinOptions {
        jvmTarget = '17'
    }
 

์ด๋ ‡๊ฒŒ ๋ชจ๋“  ๋นŒ๋“œํŒŒ์ผ(build.gradle)์˜ ๋ฒ„์ „์„ ๋‹ค ๋งž์ถฐ ์ฃผ๋‹ˆ ๋ฌด์‚ฌํžˆ ๋นŒ๋“œ๊ฐ€ ๋๋‹ค.

 

๋ฉ€ํ‹ฐ๋ชจ๋“ˆ์„ ์“ด๋‹ค๋ฉด ๋„๋ฉ”์ธ ๋ชจ๋“ˆ์—์„œ ์ด๋Ÿฐ ๋ฌธ์ œ๊ฐ€ ์ƒ๊ธธ ์ˆ˜ ์žˆ๋Š”๋ฐ ๊ทธ๋•Œ๋„ ๋ฒ„์ „์„ ๋งž์ถฐ์ฃผ๋ฉด ํ•ด๊ฒฐ๋˜๋Š” ์˜ค๋ฅ˜๋‹ค.

"๋Œ“๊ธ€, ๊ณต๊ฐ ๋ฒ„ํŠผ ํ•œ ๋ฒˆ์”ฉ ๋ˆ„๋ฅด๊ณ  ๊ฐ€์ฃผ์‹œ๋ฉด ํฐ ํž˜์ด ๋ฉ๋‹ˆ๋‹ค"
๋ฐ˜์‘ํ˜•
COMMENT