Kotlin script fails to build in maven

151 views Asked by At

I'm trying to build kts scripts with maven but I'm unable to compile them. Is it even possible to build kotlin scripts using maven? Same code using gradle compiles just fine.

Script base class:

package com.test.scripts.api

import kotlin.script.experimental.annotations.KotlinScript

@KotlinScript(displayName = "My KTS Script", fileExtension = "script.kts",
compilationConfiguration = ScriptConfiguration::class)
abstract class Script {

    fun test(id: Int) {

    }

}

Script configuration:

package com.test.scripts.api

import kotlin.script.experimental.api.ScriptCompilationConfiguration
import kotlin.script.experimental.api.defaultImports

class ScriptConfiguration: ScriptCompilationConfiguration({
    defaultImports(
        "com.test.scripts.api.Script"
    )
})

Script: test.script.kts

package com.test.scripts.content

test(1)

Error: test.script.kts:[3,1] Unresolved reference: test

POM: https://pastebin.com/z8fjzFBg

0

There are 0 answers