Project.fileTree(dir: myDir) gives No signature of method

(Martin d'Anjou) #1

Why won’t the following work?

def ft = Project.fileTree(dir: '.')

It is the only line in my build.gradle file. It gives me:

No signature of method: static org.gradle.api.Project.fileTree() is applicable for argument types: (java.util.LinkedHashMap) values: [[dir:.]]

Documentation says I can pass a map argument.

(Mark Vieira) #2

The key word in the error message you are getting there is static. There is no static method fileTree() on the Project interface. You should be calling the instance method on the project object. Essentially, just use a lowercase “p” :wink:

project.fileTree(dir: '.')

or better yet, omit the prefix altogether, since your build.gradle file delegates automatically to the project object.

fileTree(dir: '.')