Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

bind custom code formatter to eclipse project

I have a custom code formatter that I have set in my Java projects. All code changes get automatically formatted on save. My projects are saved via SVN on a server, so others can work on them as well.

The problem is that I want to have a single code formatter (mine) to be applied on all machines. The way it is now, I have to go to a new machine, check out the code (the formatter is in the repository as well), import the project to eclipse and manually change the eclipse settings to use that code formatter. Is there a way to do that on project level instead of IDE level? So I don't have to do this manually on every machine?

like image 372
brimborium Avatar asked Apr 16 '13 13:04

brimborium


People also ask

How do I use code formatter in Eclipse?

To format your whole script: Open the required file. Go to Source | Format Document or press Ctrl+Shift+F.

How do I import code formatter XML into eclipse?

All you need is to export settings from Eclipse (go to Eclipse's Preferences → Java → Code Style → Formatter and export the settings to an XML file via the Export All button.), and then open IntelliJ IDEA Settings → Code Style → Java, click Manage, and import that XML file by simply clicking Import.


1 Answers

Open the context menu of the project -> Properties -> Java Code Style -> Formatter. Check "Enable Project specific settings" and configure the profile.

All the important Java related settings are available on a per project base and you should never modify Java related settings through Window -> Preferences, if you share the project with others. Project properties are saved in your project (and therefore shared with all), preferences are stored far away and unrelated to your project.

like image 125
Bananeweizen Avatar answered Oct 19 '22 14:10

Bananeweizen