Hi Everyone! I'm trying to convert my gradle build...
# gradle
g
Hi Everyone! I'm trying to convert my gradle buildscript to kotlin. This was my original script: https://github.com/sandrobraendli/ExcelTaImport/blob/master/build.gradle And this is what I came up with so far: https://github.com/sandrobraendli/ExcelTaImport/blob/gradle-kotlin/build.gradle.kts The problem is, when I try to compile, I get the following error (multiple times): e: C\Users\sbraendli adm.ZSO\IdeaProjects\ExcelTaImport\src\main\java\io\braendli\importer\Importer.kt (33, 45): Unresolved reference. None of the following candidates is applicable because of receiver type mismatch: @InlineOnly public inline fun <T : Closeable?, R> ???.use(block: (???) -> ???): ??? defined in kotlin.io From what I understand, this is because the default jvmTarget for Kotlin is 1.6. Despite some intense googling and trying, I couldn't make the error go away. I hope someone can help.
c
You have wrong dependency, instead of
compile(kotlin("stdlib"))
you need
compile(kotlin("stdlib-jdk8"))
g
This worked, thank you very much.
However, I don' understand how this is the same as what I did in the original gradle script. https://github.com/sandrobraendli/ExcelTaImport/blob/a03893603f4d5d2bff62e7aaa8b2498a3357b112/build.gradle
c
g
You are right So I guess this wasn't needed:
Copy code
compileKotlin {
    kotlinOptions {
        jvmTarget = "1.8"
    }
}