FileNotFound error when importing new gradle project

I have a number of multiproject gradle projects. We have a number of custom plugins imported in the root build.gradle file. One in particular checks for ${project.rootDir}/resources and does some work based on that.

When importing any of my root projects, I’m currently getting a

Could not fetch model of type ‘GradleBuild’ using Gradledistribution

Failed to apply plugin [id 'myplugin]

When I drill down to the details, it shows a: It seems that when Buildship evaluates the gradle file, it incorrectly interprets the ${project.rootDir} in my custom plugin to be my user’s home directory rather than the usual root project directory. I’ve been using the plugin on the command line with no issues. It’s only when I try to do this via Buildship that I get this.

I’ve tried both the latest release and milestone builds of Buildship, am running Eclipse Mars and have tried various builds of Gradle (2.3, 2.6, 2.7rc2, etc…)

Any thoughts? Any information I’m missing?

Thanks in advance!

By any chance, are you declaring files in your plugin using the class ?
This can mess up with Buildship, as the result will depend on the current directory where gradle is executed, especially when dealing with relative paths.

If this is the case, try to use project.file() instead, which is a gradle method that guarantees to return a file instance relative to the Gradle project, and not the current directory.

That seems to have fixed my issue. Thanks! (project.getRootProject().file() for anyone else who needs this)