tags:

views:

50

answers:

2

I have a Java project I'd like to commit to my SVN repository, created with eclipse.

Now, what files (aside from the source code, obviously) are necessary? In the workspace root, there is a .settings folder with many files and subfolders, and inside the project folder there are two files - .classpath and .project, and another .settings folder with a single file - org.eclipse.jdt.core.prefs.

Which of these files should be committed to SVN and which can be safely excluded?

+2  A: 

You can exclude the .settings folder, but the .project file will be useful to other developers who want to reconstruct the same exact Eclipse project. If you examine the file it should only have relative references (if it doesn't, you should modify it as such.)

dplass
You're referring to the .settings folder within the project directory, of course? And what about the .classpath file?
Jake Petroules
As the other answer said, yes, `.classpath` is needed too, sorry.
dplass
+4  A: 

They're all useful if you want to have consistents settings across your team.

.classpath and .project mean everyone can get up and running with a project just by importing it. Any changes to the libraries and source files included in the project will be picked up by everyone when they're checked in.

The .settings directory has things like code formatting options and what the compiler considers as warnings, errors, or OK. For consistency, I've started checking these in as well (as long as everyone on your team can agree to a standard for formatting, I guess).

I've found that the biggest limitation in sharing things across version control in Eclipse is in the library definitions. Library definitions seem to be only stored on a per-user basis, so if you reference a "library" in the .classpath file, every other user has to manually define the contents of that library (or manually import your exported library definitions file).

Ash
+1 for mentioning the .settings. For our project I've found this file to invaluable as we avoided putting up a lot of documentation regarding coding guidelines and formatting rules. Instead we spent that time to agree upon all the options that eclipse gives us and just checked them into the project.
Herminator