如何使Kotlin编译器将警告视为错误? [英] How do I make the Kotlin compiler treat warnings as errors?

查看:246
本文介绍了如何使Kotlin编译器将警告视为错误?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个Kotlin项目,我想将Kotlin警告视为错误.我该怎么办?

I have a Kotlin project where I'd like to have Kotlin warnings treated as errors. How can I do that?

推荐答案

从Kotlin 1.2开始,支持命令行参数-Werror.在Gradle中,它名为allWarningsAsErrors:

Since Kotlin 1.2, the command line argument -Werror is supported. In Gradle, it's named allWarningsAsErrors:

compileKotlin {
    kotlinOptions.allWarningsAsErrors = true
}

这篇关于如何使Kotlin编译器将警告视为错误?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆