Managing the Java compiler settings in Eclipse
Recently I had to create a new workspace for my Eclipse. I like using multiple workspaces, it helps me to split the work into different domains (one workspace for the current trunk, one for maintaining the previous release, one for the internal tools - basically one workspace for each complex project). After creating the new workspace I have realized that all my Java compiler settings (for example the error and warning configuration) are gone - they are workspace-specific.
There is a way in Eclipse to export and import the settings ("File" -> "Export", then select "General" -> "Preferences"). What I did not like is that the resulting file was not readable and it apparently contained more than I wanted to migrate.
It has turned out that you can configure your compiler settings once and then just clone them in order to create project-specific settings.If you open the compiler settings (for example "Errors/Warnings"), you will see an item called "Configure Project Specific Settings…". That is it, if you open it you will get a copy of your current settings in ".settings" directory of your current project - "org.eclipse.jdt.core.prefs" file.
The beauty of this approach is that you can once store this file along with your code, commit it to your favorite source code control system and then everyone working on this project will have to respect your coding policies.
blog comments powered by Disqus