Piotr Gwiazda
Piotr Gwiazda

Reputation: 12212

Should I put Eclipse settings and .project file to SCM when using Maven?

Should I put .classpath, .project files and .settings files on SCM when working with Maven project with m2eclipse plugin? Theoretically every developer can grab the sources and import maven projects.

Due to your experience is it better to do this that way or to put Eclipse files to SCM too? Some developers are using InteliJ so I don't want the projects to be Eclipse specific. It seems that the .project file may change according to the set of installed plugins, e.g. change buildCommand from org.eclipse.jdt.core.javabuilder to org.eclipse.wst.common.project.facet.core.builder etc.

Please share your knowledge and experience.

Upvotes: 2

Views: 697

Answers (4)

Nicola Musatti
Nicola Musatti

Reputation: 18218

One situation in which it is very convenient to have Eclipse project files under version control is when you have Java code automatically generated by plugins. Eclipse removes missing source directories from its configuration before code generators run.

UPDATE

With recent Eclipse releases (I'd say since Juno, certainly since Mars) this is no longer the case.

Upvotes: 2

Nicola Musatti
Nicola Musatti

Reputation: 18218

Over the years the m2e plugin was greatly improved and nowadays there is really no need to store project settings in your SCM, as these settings are properly recreated from the project POM. This has the added benefit of allowing the use of different Eclipse releases with the same project.

Upvotes: 1

Metalhead
Metalhead

Reputation: 1449

As per my experience , it is safe to check-in .project file as it defines the nature and other properties which is useful for developers who will be creating new workspace. Many times, custom facets needs to be added via Eclipse and you may want to share it with other members of your team provided all others use the same IDE for example RAD. They won't have to go through the pain of again setting and changing project nature, so it might help. Even we had to share our .settings folder in most cases because ppl were facing issues with workspace setup. So all depends on the need and it might help.

Upvotes: 3

Miquel
Miquel

Reputation: 15675

In my experience, you should not include .classpath, .project or .settings. All the information needed to re-import the project is in the pom file, so long as you use "import existing maven projects".

If you put all those local ones, you are likely to end up having SCM changes for irrelevant things, such as different order of entries, local modifications someone made to their project preferences, etc...

Upvotes: 7

Related Questions