So I pretty much ripped this off verbatim from the Gradle Cookbook:
task aggregateJavadoc(dependsOn: clean, type: Javadoc) {
source subprojects.collect { project ->
project.sourceSets.main.allJava
}
destinationDir = file("${buildDir.absolutePath}/javadoc")
classpath = files(subprojects.collect { project ->
project.sourceSets.main.compileClasspath
})
}
When I run this, everything works as expected.
But when I add << and run the following I get an error:
task aggregateJavadoc(dependsOn: clean, type: Javadoc) << {
source subprojects.collect { project ->
project.sourceSets.main.allJava
}
destinationDir = file("${buildDir.absolutePath}/javadoc")
classpath = files(subprojects.collect { project ->
project.sourceSets.main.compileClasspath
})
}
The error is
Execution failed for task ':aggregateJavadoc'.
Cause: Error validating task ':aggregateJavadoc': No value has been specified
for property 'destinationDir'.
Again, the task is precisely written as the other but with the << added only.
I've read the docs pretty carefully on the lifecycle, and I am not able to
figure out what the difference is between these two executions. I can see how
something can fail in the configuration phase because not everything has been
configured, but I have trouble understanding how anything can fail in the
execution phase once everything is in place.
Any insight into the difference between these two tasks is appreciated.
Thanks.