Gradle Project Nature sometimes disappears when cleanly closing Eclipse project

Hi. Every now and then when I reopen a previously imported Gradle project it doesn’t work becase of 2 things:

  • The Gradle Project Nature is no longer in the .project file and “Refresh Gradle Project” menu item is not available
    • To fix that I have to manually add “Gradle Project Nature” in the Eclipse project properties
  • connection.project.dir= is missing in .settings/org.eclipse.buildship.core.prefs and “Refresh Gradle Project” fails instantly and silently
    • To fix that I open .settings/org.eclipse.buildship.core.prefs in a text editor and add the property with the empty value: connection.project.dir=

I checked the file modification time. It’s always the time when the last time I closed the project.

Also, it doesn’t happen to all projects, only to Gradle sub-projects that have their own settings.gradle.