So lot’s of people use “dynamic” tasks in gradle, like so:

Which is now deprecated:

The TaskInternal.execute() method has been deprecated and is scheduled to be removed in Gradle 5.0. There are better ways to re-use task logic, see https://docs.gradle.org/4.4/userguide/custom_tasks.html#sec:reusing_task_logic.

We found ourselves in this position with the com.eriwen JS and CSS minification plugins.  The answer for us was to not use tasks at all, but rather go directly to the Groovy source.  So instead of the above example, we did the following:

Not only does this get around the deprecation and imminent removal, as you can see it’s quite a bit shorter, cleaner and easier to read.  Multiply this by the number of tasks we applied this to, and the improvement to the overall codebase is non-negligible.