Gradle task should not execute automatically

A common pitfall. Add an action to the task otherwise code will run at configuration phase. Sample task with action:

task sample << {
}

As I see You’d rather need to write a custom task than using Exec type. I suppose it’s not valid to define commandLine twice.

EDIT

You can read this post to get the general idea how it all works.

Leave a Comment