30

We are in the process of standardizing our default Eclipse configuration (styles, settings, dictionary, formatting, run configurations, etc.) for our developers.

However, for Java compiler errors and warnings preferences, there does not seem to be any way to export/import settings. Is there another way to do this?

Dave
  • 21,524
  • 28
  • 141
  • 221

6 Answers6

30

Eclipse allow you to export your preferences via

File > Export > Preferences

You will see a list of exportable preferences, which contains Java Compiler Preference, you can even choose specified preference to export.

After that, you can import the preferences into a new workspace via

File > Import > Preferences

Rangi Lin
  • 9,303
  • 6
  • 45
  • 71
14

The ideal way to share settings within the team (for use within the IDE) is to use project specific settings. The project specific settings become part of the project and go into source control repository, hence every team member gets them for free.

Most of the settings you mention in the question can be configured per project.

Deepak Azad
  • 7,903
  • 2
  • 34
  • 49
  • 3
    Are you saying to check the ".settings" directory into source control? If so, I am tempted to do that, but does it break if we are not all using the same version of Eclipse with the same plugins? – Dave Mar 07 '12 at 05:32
  • 3
    Yes, I am saying exactly that, and it is a standard practice. Ideally the team should be using the same IDE version :-) However, things do not normally break if you do use different versions. You can set the preferences based on lowest Eclipse version in the team, the newer Eclipse versions would just work correctly. (Even in the extremely rare case something goes wrong, the consequences should be mild) – Deepak Azad Mar 07 '12 at 05:49
  • I'm going to leave Randi Lin's answer as the accepted answer as it exactly answers the original question, but I personally have implemented your suggestion to make these changes in the individual projects and check in the `.settings` directory. If this works it'll be incredible...I've already delete pages of wiki documentation..... – Dave Mar 08 '12 at 20:10
  • I've been successfully using this approach now for 2 years since you last made it. Switching this to be the accepted answer. – Dave Feb 28 '14 at 19:00
  • 1
    IDE specific config files in source control? Hmmmm, that is such a hit-and-miss thing. My preference is not to do that at all. YMMV obviously. – luis.espinal Aug 12 '16 at 14:19
3

I've developed a maven plugin (called codecleaner) that spread pre-configured eclipse settings for maven projects. It is very usefull wehn you dont want to put eclipse settings under version control, or when you want to save the time for manulay add the settings for each of the projects

https://github.com/yonatanm/codecleaner

currently The codecleaner plugin update the following types of eclipse settings:

  • Code Formatter
  • Save Actions
  • Clean up settings
  • Compiler Error/Warning level
  • JSP/XML/XSD/HTML Validation
Yonatan Maman
  • 2,428
  • 1
  • 24
  • 34
2

In our team we use workspace mechanic to share the same workspace preferences by putting the preferences files on a shared drive. A small introduction can be read here.

baumato
  • 358
  • 3
  • 13
1

Create a common build file (using Ant/Maven). If you use Maven, you can even ensure that the same jars are used by everyone while compiling.

Chetter Hummin
  • 6,687
  • 8
  • 32
  • 44
  • 1
    We are big users of Maven and consider it more important than our IDE, but yet the IDE is still important. Nothing in Maven that I am aware of will help us common our Eclipse preferences. I realize the way I asked the question it sounded like I was asking about compiler settings when I was really asking about compiler validation preferences. I have clarified the original question I think. – Dave Mar 06 '12 at 05:56
  • @HDave Mea culpa. I misinterpreted the question I think! – Chetter Hummin Mar 06 '12 at 06:27
0

This can be fixed outside of Eclipse, starting with standardizing the build process as Amit mentioned.

You might also want to consider a continuous integration system which builds every time someone commits code. This keeps everybody on their toes, preventing people from pushing broken code. Any compiler errors/warnings are visible to everyone.

Ian Bishop
  • 5,185
  • 3
  • 26
  • 37
  • Yup, already have Hudson up and running with a Matrix job for all app server/database combinations, but this doesn't help with IDE standardization. I realize now that the way I framed the question wasn't clear and I have fixed it. – Dave Mar 06 '12 at 05:56