What is the difference between these task definition syntaxes in gradle?

Posted by bergyman on Stack Overflow See other posts from Stack Overflow or by bergyman
Published on 2010-05-04T18:18:43Z Indexed on 2010/05/05 5:18 UTC
Read the original article Hit count: 249

Filed under:

A)
task build << {
description = "Build task."
ant.echo('build')
}

B)
task build {
description = "Build task."
ant.echo('build')
}

I notice that with type B, the code within the task seems to be executed when typing gradle -t - ant echoes out 'build' even when just listing all the various available tasks. The description is also actually displayed with type B. However, with type A no code is executed when listing out the available tasks, and the description is not displayed when executing gradle -t. The docs don't seem to go into the difference between these two syntaxes (that I've found), only that you can define a task either way.

© Stack Overflow or respective owner

Related posts about gradle