Is there possibility to run single task twice during build script execution?

Is there possibility to run single task twice during build script execution? I need to run one task twice.

That’s because I want to run it with different settings.

The only thing I see now, is to make an external build.gradle. Even though it is not so obvious for me

There is no way to add a task to the task graph twice. It may not be immediately intuitive, but what you likely want is to have two different tasks of the same type, each named/configured differently (rather than a single task run twice).

Yeah, solved it by using two build.gradles which are running in a sequence one after another from root build.script

In my case decided to run the script twice, from the root build script. But actually there is a possibility to run method twice with this construction, but bad thing is that it is not launching all depending task task insertion() << {

tasks.taskA.execute() } <.code>

I think you should do:

task insertion << {
    // do stuff
}
  insertion.dependsOn taskA