gpt4 book ai didi

java - 替换 Checkstyle 已弃用的 Gradle LoggingManager.setLevel()

转载 作者:太空宇宙 更新时间:2023-11-04 12:25:40 24 4
gpt4 key购买 nike

我在 Gradle 构建中使用 Checkstyle 插件。当使用 -info 标志运行 Gradle 时,Checkstyle 会产生过多输出。我在 this question 中寻求帮助。解决方案是将以下内容添加到 Gradle 脚本中:

[checkstyleMain, checkstyleTest].each { task ->
task.logging.setLevel(LogLevel.LIFECYCLE)
}

您可以在上下文 here 中看到该脚本。这个解决方案一直很好,直到最近 Gradle 中的一项更改导致 setLevel() 方法被弃用。我现在在 Gradle 2.14 中看到以下错误:

LoggingManager.setLevel(LogLevel) has been deprecated and is scheduled to be removed in Gradle 3.0. If you are using this method to expose Ant logging messages, please use AntBuilder.setLifecycleLogLevel() instead.

有谁知道如何在使用 -info Gradle 标志时消除 Checkstyle 插件的过多日志记录而不触发弃用警告?

最佳答案

您可以使用;

ant.lifecycleLogLevel = "ERROR"

而不是;

logging.setLevel(LogLevel.ERROR)

注意:以下是 ant.lifecycleLogLevel 的可能级别:

DEBUG, VERBOSE, INFO, WARN, ERROR;

关于java - 替换 Checkstyle 已弃用的 Gradle LoggingManager.setLevel(),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38420738/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com