How to clean the top level project?

Ok. I’ve been on vacation and am only now getting back to this issue. I tried the approach mentioned in the link that Stefan originally provided and it does work; however, it produces a deprecation warning message:

Defining custom ‘clean’ task when using the standard Gradle lifecycle plugins has been deprecated and is scheduled to be removed in Gradle 3.0

So this does not seem like a stable solution. Is there another way?