首页 > 解决方案 > Enforcing JDK package usage in kotlinc

问题描述

I need to use JDK11 to build a certain Gradle project but this project needs target JDK 8 as minimum. So I'd like to ensure that no one accidentally checks in code using classes from newer JDKs. I am working in a mixed mode project and for java this works:

    compileJava {
        options.release = 8
    }

I can't find the switch for Kotlin, does kotlinc just not have this support ?

Note: this does not work.

   compileKotlin {
        kotlinOptions.jvmTarget = "1.8"
    }

标签: kotlingradlejvm

解决方案


推荐阅读