Allan Lewis wrote:
Thanks - I'll give your suggestion a try. Is this something that will be
fixed? Is there a JIRA I can keep my eye on?
I don't think so. Could you add one?
Adam Murdoch-2 wrote:
Interesting. When a task action closure executes, we set its (groovy)
resolve strategy to OWNER_FIRST. In your example, the owner is the
subprojects { } closure. This closure has its resolve strategy set to
DELEGATE_FIRST, and the delegate will be set to the last project
configured, ie project 'subB'. What this means is that whenever the task
action closure executes, 'project.name' will be resolved against project
'subB', regardless of which project the executing task is actually in.
We should probably be using DELEGATE_FIRST as the resolve strategy for
task actions. Until we fix this, you can use something like:
subprojects {
...
createTask('generateSources') {
logger.error('My name is: ' + *delegate*.project.name)
}
}