Skip to content

Instantly share code, notes, and snippets.

@huuphuoc1396
Last active May 4, 2022 18:53
Show Gist options
  • Save huuphuoc1396/497c27c1fac205f5d9c6696016227e1c to your computer and use it in GitHub Desktop.
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"
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)
// 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"
}
}
}
}
@anatolyw
Copy link

anatolyw commented Feb 4, 2022

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