In a gradle file, all methods and properties are resolved against a project instance. so the first exec really is project.exec({...}), and the second exec is println(project.exec). You can type it like that in gradle as well, giving you somewhat better IDE support.
Also there is a gradle forum for gradle related questions, which may be better than this mailing list for this kind of question.