How to skip deprecation warnings


(dinio.dinev) #1

In our plugins we use classes which use Gradle 1.5 syntax in their methods and they are deprecated in 1.7 . We can’t fix their code because it is external for us but when the we start our build deprecation messages are thrown. I know that these warnings extends error, but in Gradle 1.7 is there way to skip them? Thanks.


(Luke Daley) #2

There’s no public API for disabling deprecation messages unfortunately.

There is an internal API though:

org.gradle.util.SingleMessageLogger.whileDisabled {
  apply plugin: "some-plugin"
}

Note that this is internal API. It may change at any time without notice.


(dinio.dinev) #3

Problem I add this code in my plugin which is java code. When I pass an action

org.gradle.util.SingleMessageLogger.whileDisabled(new Action<Project>()) {
   public void execute(Project rootProject) {
        project.getPlugins().apply(ExternalPlugin.class);
   }
  });

But error is thrown

method SingleMessageLogger.whileDisabled(Runnable) is not applicable
      (actual argument <anonymous Action<Project>> cannot be converted to Runnable by method
 invocation conversion)

How to deal with that?


(Luke Daley) #4

Because the method takes a Runnable, and an Action is not a Runnable.


(dinio.dinev) #5

oooo Sorry I saw action and wrote new Action. Thanks again.