Search code examples
gradlegroovybuild.gradlesuppress-warningssuppressmessage

How to suppress gradle warning about Deprecated Gradle features?


I am using the latest Gradle v7.2

When I compile it gave me warning

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

I checked with --warning-mode all, it is only about jcenter deprecation

> 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.)

Now, how can I make gradle ignore exactly one line in build.gradle ( in this case jcenter usage, but may be any ) so that "Deprecated Gradle features were used" would go away,
until new feature is deprecated or my build script got changes?


Yes, this question is not about suppressing compiler output for code,
but for .gradle files produced by gradle.

Not using --warning-mode as it can hide and show all warnings.

P.S. Exactly the case, I have dependency, that are only on jcenter.


Solution

  • Sorry - you may not like the answer.

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