Do I need to check in ".settings/org.eclipse.buildship.core.prefs" file?

I had a buildship project working reasonably well in Eclipse. I had all of the code that I thought needed to be checked in pushed to my bitbucket server.

I had run into a bug unrelated to buildship, concerning egit, so I cloned my project a second time to a separate location, deleted the existing project (not the contents), and imported the project again from that location (using the “Import Project…” function from the git repository context menu in Eclipse). I noticed that I was getting unexpected errors in the new project.

The first thing I saw was that it only had “src” as a source folder, instead of what I had before (“src/{main,test}/java”). I manually fixed that in the build path, but I was still seeing odd errors. I then looked in the workspace log, and I saw the following:

    Caused by: java.io.FileNotFoundException: ...\.settings\org.eclipse.buildship.core.prefs (The system cannot find the path specified)
    at java.io.FileInputStream.open0(Native Method)
    at java.io.FileInputStream.open(FileInputStream.java:195)
    at java.io.FileInputStream.<init>(FileInputStream.java:138)
    at org.eclipse.buildship.core.configuration.internal.PreferenceStore$PropertiesFilePreferenceStore.loadProperties(PreferenceStore.java:151)
    ... 64 more

That file certainly wasn’t there, as I had never checked in that file. I’ve always been under the impression that files in “.settings” should never be checked in. Fortunately, as I’d debugged the egit issue well enough, I deleted this new project and reimported from the original location, which still had the “org.eclipse.buildship.core.prefs” file in its original location. This worked, of course.

So, what’s the situation with “.settings” files? Again, I thought those were not supposed to be checked in, but clearly Buildship got confused by the absence of that file.

This would happen if you have a checked in .project file with the buildship nature, but no checked in settings file. The choice is between checking in both or checking in neither and using the Gradle import wizard.

2 Likes

Ok, got it. I’m used to .settings files being “personal preferences”, but I can live with checking this in.