Gradle 使用 Kotlin 的情况下设置使用 UTF-8

发布时间 2023-05-28 16:40:57作者: Starsdust

找了好久才找到该怎么整,在此记录一下

原本的样子

Groovy 下设置 UTF-8:

tasks.withType(JavaCompile) {  
    options.encoding = "UTF-8"  
}

但是现在改了,食大便了

Kotlin 下设置 UTF-8

tasks.withType<JavaCompile> {
    options.encoding = "utf-8"
}

将此段话加入到build.gradle.kts中即可