What is the best way to have a common code (java) formatting when using both Netbeans and Eclipse in a project? I have been searching for a solution but cannot find anything really suitable. I came accross jalopy as a maven plugin but I'm looking for something which is free.
Asked
Active
Viewed 2,065 times
2 Answers
1
We are using Eclipse Code Formatter plugin for Netbeans for Java files. We have defined formatting rules in Eclipse.

Saljack
- 2,072
- 21
- 24
1
As you are using Maven you might want to have a look at the Checkstyle plugin. It's integrated with the Netbeans project settings and you have editor support. I don't know about the quality of Eclipse integration, but at least you can enforce the rules you like.

Waldheinz
- 10,399
- 3
- 31
- 61
-
Yes I had a look at checkstyle and it looks promising. Is it also possible to "apply" the rules so the developers don't have to do manual format corrections? What I could see it will only give warnings? – Björn May 24 '11 at 11:58
-
When editing a source file, hitting "ALT+SHIFT + F" (aka "Format") will re-format your code according to the CheckStyle rules, including adding missing braces and newlines and whatnot. I'm not aware of a method to apply the rules to a full tree of source files, though. – Waldheinz May 25 '11 at 11:08
-
Ok thanks, formatting per file will be good enough so it answers my question. – Björn May 27 '11 at 12:32
-
Hi, Can you share the checkstyle rules file you used to keep NetBeans and Eclispe the same. – DarVar Jan 24 '13 at 19:41