Closure defined in root not visible in child
问题 I have root project and subproject ( :child ). Root build looks like like this: def foo = { println("foo") } allprojects { task bar << { println(project.name + ":bar") } afterEvaluate { foo() } } Running gradle bar prints: foo foo :bar :child:bar child:bar parent:bar This make sense. However, IRL I need foo to be called by the child's build file (because I want it to be called only by some of the submodules). The documentation seems to be clear enough: In a multi-project build, sub-projects