Kotlin Gradle Plugin Version Update Issue

반응형

Kotlin 1.5

 

Case

Gradle Script를 통해 Kotlin Version 을 업데이트할 때 생기는 문제입니다. 이번 케이스 같은 경우 1.6으로 업데이트했습니다. 실제로는 1.5 버전으로 업데이트부터 발생합니다.

kotlin version:
 - AS-IS: 1.4
 - TO-BE: 1.6

아래와 같이 Gradle Plugin version을 변경합니다.

plugins {
    // 생략 ..
    kotlin("jvm") version "1.6.10"
    kotlin("plugin.spring") version "1.6.10"
    kotlin("plugin.jpa") version "1.6.10"
    kotlin("plugin.allopen") version "1.6.10"
    kotlin("kapt") version "1.6.10"
 }

Issue

jacoco

Jacoco Report 생성시 다음과 같은 에러 메시지와 함께 빌드가 실패합니다. 

* What went wrong:
Execution failed for task ':app-domain:jacocoTestReport'.
> Error while creating report


Caused by: : Error while creating report
        at org.jacoco.ant.ReportTask.execute(ReportTask.java:502)
...
Caused by: java.lang.IllegalStateException: Unexpected SMAP line: *S KotlinDebug
        at org.jacoco.core.internal.analysis.filter.KotlinInlineFilter.getFirstGeneratedLineNumber(KotlinInlineFilter.java:98)
...
Unexpected SMAP line: *S KotlinDebug

Solution

다음과 같이 Jacoco Plugin version도 "0.8.7" 이상으로 업데이트를 해줘야 합니다.

    tasks {
        test {
            useJUnitPlatform()
        }

        jacoco {
            // JaCoCo 버전
            toolVersion = "0.8.7"
        }
   }

https://www.jacoco.org/jacoco/trunk/doc/changes.html

 

JaCoCo - Change History

Change History Snapshot Build 0.8.8.202202030459 (2022/02/03) New Features Experimental support for Java 18 class files (GitHub #1198). Experimental support for Java 19 class files (GitHub #1264). Part of bytecode generated by the Java compilers for assert

www.jacoco.org

Jacoco 변경 사항은 다음과 같습니다.

Release 0.8.7 (2021/05/04)
New Features
Branches added by the Kotlin compiler version 1.5.0 and above for functions with default arguments are filtered out during generation of report (GitHub #1162).
Branch added by the Kotlin compiler version 1.5.0 and above for reading from lateinit property is filtered out during generation of report (GitHub #1166).
Additional bytecode generated by the Kotlin compiler version 1.5.0 and above for when expressions on kotlin.String values is filtered out during generation of report (GitHub #1172).
Improved filtering of bytecode generated by Kotlin compiler versions below 1.5.0 for when expressions on kotlin.String values (GitHub #1156).
반응형

'Backend > Debug' 카테고리의 다른 글

[Debug] Difference between SQS Fifo vs Standard Message  (0) 2022.06.24