Last active
May 4, 2022 18:53
-
-
Save huuphuoc1396/497c27c1fac205f5d9c6696016227e1c to your computer and use it in GitHub Desktop.
Compiling with language version 1.5 breaks JaCoCo: "Unexpected SMAP line: *S KotlinDebug"
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':jacocoFullReport'. | |
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.lambda$executeIfValid$3(ExecuteActionsTaskExecuter.java:186) | |
Caused by: : Error while creating report | |
at org.jacoco.ant.ReportTask.execute(ReportTask.java:502) | |
Caused by: java.io.IOException: Error while analyzing PersonalRequestHelper.class. | |
at org.jacoco.core.analysis.Analyzer.analyzerError(Analyzer.java:162) | |
Caused by: java.lang.IllegalStateException: Unexpected SMAP line: *S KotlinDebug | |
at org.jacoco.core.internal.analysis.filter.KotlinInlineFilter.getFirstGeneratedLineNumber(KotlinInlineFilter.java:98) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Refer from https://youtrack.jetbrains.com/issue/KT-44757#focus=Comments-27-5247441.0-0 | |
// The issue Gradle version: 7.0.2, Kotlin: 1.5.30. Jacoco: 0.8.7 Just applying the jacoco version might not always work. | |
jacoco { | |
toolVersion = "0.8.7" | |
} | |
// Use the resolution strategy along with the version in the app.gradle. It will fix the issue. | |
configurations.all{ | |
resolutionStrategy { | |
eachDependency { details -> | |
if ('org.jacoco' == details.requested.group) { | |
details.useVersion "0.8.7" | |
} | |
} | |
} | |
} |
In case you use gradle kotlin
:
configurations.all {
resolutionStrategy {
eachDependency {
if ("org.jacoco" == requested.group) {
useVersion("0.8.7")
}
}
}
}
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks for that bro. That saves me a lot of time