Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Eclipse Save Actions in Source Control

We'd like to find a "lightweight" method of enforcing code standards prior to check-in. We really like the idea of using Eclipse's built-in Save Actions (go to Preferences >> Java >> Editor >> Save Actions) which has a Format source code function that can run every time the developer saves a file.

This way, so long as each developer using the same format rules, and has Save Actions enabled, we can be fairly comfortable that by the time code makes it to review, that our code standards have been enforced (for the most part).

What I'm trying to figure out is: what file(s) does Eclipse use to save these format rules to? How could I keep such a file in source control, and have developers check it out?

  • Where is it located (within the workspace)?
like image 831
IAmYourFaja Avatar asked Feb 11 '12 01:02

IAmYourFaja


1 Answers

The workspace-wide save action configuration is stored in your workspace directory in this file:

WORKSPACE-DIR\.metadata\.plugins\org.eclipse.core.runtime\.settings\org.eclipse.jdt.ui.prefs

Adding this file to source control would be somewhat tricky, as it is workspace-specific and not project-specific. You can however, enable project-specific save action configuration via the save action wizard. In that case, the configuration is stored in your project path, under:

PROJECT-DIR\.settings\org.eclipse.jdt.ui.prefs

This file can easily be put under source code control.

like image 97
joergl Avatar answered Nov 13 '22 14:11

joergl