Lii
Lii

Reputation: 12131

How to share Eclipse project settings between projects?

What is the best way to share project specific settings between multiple Eclipse projects?

I'm working with an application that is divided into several Eclipse projects. All of the Eclipse projects should use the same compiler settings. I could duplicate the settings in all the projects, but I'm looking for a way to avoid that.


The relevant settings are the ones that are saved in <PROJECT_LOC>/.settings, most importantly org.eclipse.jdt.core.prefs but also for example org.eclipse.jdt.ui.prefs. They are the ones that are set in Project Properties > Java Compiler, Java Code Style (and a few more places).

The solution must be version control friendly.


One possible solution use a linked resource, from org.eclipse.jdt.core.prefs or .settings of the projects to the same file, located in one of the projects. A similar solutions is to use soft file system links. I don't really like these solutions, it seems to me that they are hard to maintain, for example if the name of a project is changed.


I found this question which is different because it asks about sharing settings between developers, not between projects. (I must do both.)

How to share Eclipse project preferences between users?

Upvotes: 2

Views: 2271

Answers (3)

Lii
Lii

Reputation: 12131

A long time afterwards I got an idea about how to solve this:

  • Set up a multi-module Maven project.
  • Configure the settings in the parent pom file.
  • Import the projects into Eclipse as Maven projects.

Disclaimer: I haven't actually tested this, so I don't know how well it's working...

Upvotes: 0

Stephan Herrmann
Stephan Herrmann

Reputation: 8178

I think it depends on how frequently you expect projects settings to change.

If not frequently, you shouldn't over-engineer your solution: just configure one project and copy settings to other projects, put everything under version control and you're done, except for having to perform this operation again every other year, or so.

If frequently, and if a lot of settings are involved, and if all (most) workspace projects should indeed use the same settings, then consider creating your own Oomph setup, that would include your settings as workspace settings. Then let all projects just use the workspace settings. (Of course a few projects could still deviate and use their own project settings, but once using project specific settings, changes to workspace settings will have no effect on that project).

BTW: Oomph includes capabilities to also specify once and for all: selection of plug-ins to install plus how to populate a workspace with projects from version control, and more. So I can only recommend this tool if you are really concerned about systematic configuration of working environments: create one setup - apply it automatically hundreds of times. And no, I'm not an author of Oomph, just a happy user.

Upvotes: 1

user6738679
user6738679

Reputation:

Sharing your workspace setup using Project Sets Your workspace setup may consist of several projects from one or more repositories. Once you have setup your workspace, you can share it with others by exporting a Team Project Set. A project set is a text file that contains a pointer to each of the projects contained in the project set.When a project set is imported, these pointers are used to fetch the projects from the repository. http://help.eclipse.org/mars/index.jsp?topic=%2Forg.eclipse.platform.doc.user%2Ftasks%2Ftasks-cvs-project-set.htm

Upvotes: 0

Related Questions