Trouble with gradle incremental build

Hi,
I have project with such structure
[ROOT]
[A]
[B]

and custom gradle plugin with one task build applied to module [A][B]

Task buildTask = project.task('build', type: BuildTask)
buildTask.inputs.sourceDir('src/main/synapse-config')
buildTask.outputs.file("target/$project.name" + ".car")

When I execute gradle build from [A] project first time I see that project is builded
Second time I see that :build UP-TO-DATE , it is ok
The problem is when I execute build task third time from [ROOT] project I see build of all subprojects, but this time [A]:build is not UP-TO-DATE

Please advise. Is this expected behavior or I have some missed configuration?
Thank you in advance.