```#!/usr/bin/env kotlin @file:CompilerOptions("-X...
# scripting
p
Copy code
#!/usr/bin/env kotlin
@file:CompilerOptions("-Xopt-in=kotlin.time.ExperimentalTime","-jvm-target=1.8")
@file:DependsOn("com.github.ajalt:clikt:2.7.1")

import com.github.ajalt.clikt.core.CliktCommand
import com.github.ajalt.clikt.parameters.options.option
import com.github.ajalt.clikt.parameters.options.required
import com.github.ajalt.clikt.parameters.types.enum

enum class RPS {
  Rock
}

class Application : CliktCommand(){

  private val rps : RPS by option("--rps").enum<RPS>().required()

  override fun run() {
    println(rps)
  }
}

Application().main(args)
This doesn't compile:
Copy code
➜  scripts git:(features/huawei_health) ✗ ./test.main.kts -- --rps rock
error: cannot inline bytecode built with JVM target 1.8 into bytecode that is being built with JVM target 1.6. Please specify proper '-jvm-target' option (test.main.kts:16:44)
test.main.kts:16:44: error: cannot inline bytecode built with JVM target 1.8 into bytecode that is being built with JVM target 1.6. Please specify proper '-jvm-target' option
  private val rps : RPS by option("--rps").enum<RPS>().required()
i
The correct way to set jvm-target in CLI is without the
=
. So, your annotation should look like
Copy code
@file:CompilerOptions("-Xopt-in=kotlin.time.ExperimentalTime","-jvm-target", "1.8")
it works for me after this change. Proper diagnostic is definitely missing here. I'd appreciate very much if you'll file an issue in YouTrack about it.