Format Java Code in Netbeans / Eclipse, but save it differently

Posted by Walter White on Stack Overflow See other posts from Stack Overflow or by Walter White
Published on 2010-03-02T20:11:25Z Indexed on 2010/04/28 12:53 UTC
Read the original article Hit count: 445

Filed under:
|
|

Hi all,

I asked a related question before, but I guess the root of the question is. Let's say I have 2 developers on the team and they both like to look at code in different formats. One likes the braces to be on a new line and the other doesn't.

The approach I was using before is that anytime we run a build, the code is automatically formatted according to the Java/Sun standards using Jalopy; however, I would like the developers to be as happy as possible. They can change the font size, font color, background color, etc.

If I am currently using the Jalopy Maven plugin to format code, can/should I write a hook to SVN that calls mvn jalopy:format on the project when it's checked in? Is this reliable?

That solution doesn't work 100% because it requires the developer to manually format the source code to their liking every time they open a file that hasn't been formatted yet. I was thinking an IDE plugin would be nice as it could automatically format the source to their liking and then save it as another.

What other options do I have to ensure the code is formatted nicely on checkin?

Thanks,

Walter

© Stack Overflow or respective owner

Related posts about java

Related posts about ide