How to execute tasks multiple times in a loop

Gradle builds a Directed Acyclic Graph at runtime which means each task is represented by one node in the graph. Each node in the graph (meaning a Gradle task) can only be executed once.

The method Task.execute() should never be called. You should use methods like dependsOn or finalizedBy to control the order of execution.

Can you describe the concrete problem you are trying to solve? Do you potential want multiple actions?