1

我正在使用最新的 Gradle v7.2

当我编译它给了我警告

Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0.

You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.

See https://docs.gradle.org/7.2/userguide/command_line_interface.html#sec:command_line_warnings

我检查过--warning-mode all,这只是关于jcenter弃用

> Configure project :
The RepositoryHandler.jcenter() method has been deprecated. This is scheduled to be removed in Gradle 8.0. JFrog announced JCenter's sunset in February 2021. Use mavenCentral() instead. Consult the upgrading guide for further information: https://docs.gradle.org/7.2/userguide/upgrading_version_6.html#jcenter_deprecation
        at build_akew6bhcr0m9glzogac5s3m6w$_run_closure1.doCall(/Users/paul.verest/Workspaces/Polkadot/bcd-java/build.gradle:10)
        (Run with --stacktrace to get the full stack trace of this deprecation warning.)

现在,我怎样才能gradlebuild.gradle完全忽略 (在这种情况下使用,但可能是任何)中的一行,jcenter以便“使用已弃用的 Gradle 功能”会消失,
直到新功能被弃用或我的构建脚本得到更改?


是的,这个问题不是关于抑制代码的编译器输出,
而是关于.gradlegradle 生成的文件。

不使用--warning-mode,因为它可以隐藏和显示所有警告。

PS 确实如此,我有依赖,仅在jcenter.

4

2 回答 2

3

对不起 - 你可能不喜欢这个答案。

There is no option in gradle (7.2) to suppress specific deprecation. Fixing the build file is going to be cheaper and correct.

于 2021-09-10T18:20:01.803 回答
0

Replace the below repo in the Gradle file

jcenter()

With:

mavenCentral() 

Or:

gradlePluginPortal()

That's will suppose that the required dependencies exist in the maven repo, you have to check by making a new build.

Currently, the jcentral() repo is down.

于 2022-01-12T17:19:40.087 回答