Docs question, Example 15.12. Defining a task with closure


(Mark Waschkowski) #1

Shouldn’t

Example 15.12. Defining a task with closure

build.gradle task copy(type: Copy) {

from ‘resources’

into ‘target’

include(’/*.txt’, '/.xml’, '**/.properties’) }

read

Example 15.12. Defining a task with closure

build.gradle task myCopy(type: Copy) {

from ‘resources’

into ‘target’

include(’/*.txt’, '/.xml’, '**/.properties’) }

(Note the change of the task name from ‘copy’ to ‘myCopy’)

?

Edit: I’m not saying that the code is invalid, it does work. However, given the context of the explanation at the time, it would seem to me to be more clear to be consistent with all the examples from 15.7, 15.8, 15.9, 15.10, and 15.11 if the same name was used.

If this is correct, 15.16 should also be reviewed - it looks like 15.17 is correct because there the example shows replacing the current ‘copy’ task with a new ‘copy’ task, NOT creating a NEW copy task.

If incorrect, look forward to the explanation as I’m just learning…

Thanks,

Mark

PS. just started trying out Gradle on Friday, and it looks great!


(Szczepan Faber) #2

Thanks for feedback on the docs.

15.17 is correct because there the example shows replacing the current ‘copy’ task with a new ‘copy’ task, NOT creating a NEW copy task.

That’s correct.