Intellij的Gradle插件:如何设置' - 警告模式ALL'为了避免运行程序时的贬值警告

发布于 2025-02-01 18:39:13 字数 167 浏览 6 评论 0 原文

我正在使用Gradle插件。在构建结束时,它说:

“该构建中使用了弃用的Gradle功能,使其与Gradle 8.0不兼容。 使用' - 打击模式所有'显示各个折衷警告

。 不存在

对我来说

。在线版本不确定为什么在任何情况下都应该弃用任何功能

I am using the Gradle plugin. At the end of the build it says:

"Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0.
Use '--warning-mode all' to show the individual deprecation warnings."

But I have no idea to pass a command line option to Gradle in IDEA. I've read several suggestions to add it to the gradle.properties folder but it doesn't exist for me.

I've tried adding it to gradle-wrapper.properties but that isn't correct and doesn't change anything.

Preferably I suppose I would like to not use any deprecated gradle features. I downloaded the latest version online not sure why any of the features should be deprecated in any case.

Has anyone ever solved this before? Other answer to questions hasn't fixed the issue and I seem lost on this.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

沫离伤花 2025-02-08 18:39:13

Use org.gradle.warning.mode=(all,fail,summary,none) in the gradle.properties file.

心房的律动 2025-02-08 18:39:13

要禁用此警告,添加属性 org.gradle.warning.mode = none gradle.properties 文件,无论是在项目级别还是在全球级别上。

gradle.properties

org.gradle.warning.mode=None

将其禁用全球

将其附加到 gradle.properties 位于 .gradle 文件夹中的文件夹中的用户主目录。

要在一个步骤中进行:运行:

mkdir -p ~/.gradle && echo "org.gradle.warning.mode=None" >> ~/.gradle/gradle.properties

按照文档

枚举常数 描述
所有警告均 显示。
失败 显示所有警告,如果有任何警告,则会使构建失败。
根本 没有贬值警告。
摘要 在构建结束时显示摘要,而不是将所有警告渲染到控制台输出中。

环境

Gradle 8.3
JVM 17.0.8 (Azul Systems, Inc. 17.0.8+7-LTS)
Mac OS X 13.4.1 aarch64

To disable this warning add the property org.gradle.warning.mode=None to the gradle.properties file, either at project level or at a global level.

gradle.properties

org.gradle.warning.mode=None

To disable it globally

Append it to a gradle.properties located at the .gradle folder in the user home directory.

To do so in one step, run:

mkdir -p ~/.gradle && echo "org.gradle.warning.mode=None" >> ~/.gradle/gradle.properties

Below the valid values as per the documentation

Enum Constant Description
All Show all warnings.
Fail Show all warnings and fail the build if any warning present.
None No deprecation warnings at all.
Summary Display a summary at the end of the build instead of rendering all warnings into the console output.

Environment

Gradle 8.3
JVM 17.0.8 (Azul Systems, Inc. 17.0.8+7-LTS)
Mac OS X 13.4.1 aarch64
冷了相思 2025-02-08 18:39:13

我和其他人遇到的问题是找到gradle.properties文件。实际上,我本可以创建它。解决方案:

如果您的构建没有Gradle.properties文件,则只需在项目目录中创建文件即可。
在目录中,编写以下命令:org.gradle.warning.mode = all [这将记录未弃用的内容]
解决该问题,也可以完全消除警告,如果您选择的话。
希望这有助于一个让我发疯的人。

The problem I and other people were having was locating the gradle.properties file. Actually, I could have just created it. Solution:

If your build doesn't have the gradle.properties file just create the file in the project directory.
In the directory, write the following command: org.gradle.warning.mode=all [this will log whatever is deprecated]
Fix the issue or you can just eliminate the warnings altogether if you so choose.
Hope this helps someone it was driving me nuts.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文