Import task into a project from file

I have a script file with only one task:

task utilTask{

apply from automatically runs this task even if I just want to see list of tasks of a project. Is there way to add task to a project from separate script file?

Found solution: just change task declaration

task utilTask{


task utilTask << {

Though there is another problem: description of the task disappears in this case.

Sounds like with your change you moved the setting of the description into the execution phase of the task. Personally I prefer the doLast syntax over << for custom tasks.

task utilTask {
    // configuration phase
    description = "...description..."
    doLast {
         // execution phase: the work you want done when the task is called

Check out the docs on the build lifecycle for more insight.

1 Like

Looks really better, and description shows properly. Thanks