Rename Gradle Task

I have a desire to "wrap" tasks generated by one of the Gradle plugins, while preserving the name of the task that users interact with. It seems the best way to do this is to rename the task generated by the plugin and then create a shell task with the same name.

At first glance, TaskContainer # replace looked like a method, except that it just creates a new empty task using the original name, while I already have a task object that I want to put under that name.

How can I β€œrename” a Gradle task to create a new task using the original name while keeping the original task?

+4
source share
1 answer

, .

def oldTask = tasks.foo
tasks.remove(foo)
+4

All Articles