DEV Community

Cover image for Have anyone managed to format code in IntelliJ just like Eclipse?
Bassem
Bassem

Posted on

Have anyone managed to format code in IntelliJ just like Eclipse?

My whole team is working with Eclipse. I am the only solo adventures who prefer IntelliJ.😎

And you all must know that the whole team has to use the same formatting rules. Other than that merging will be a nightmare.

Have anyone of you guys managed to use eclipse Formatter inside IntelliJ?

I tried some guides online, both didn't really work

  1. I tried to export Eclipse formatting options and import it into IntelliJ. That for some bizarre reason didn't work. they must have different sets of options.
  2. I tried to use an IntelliJ plugin called Eclipse Formatter but it throws an error. It's not even formatting the code for me
  3. I tried to go over the options one by one in both IDEs. but gave up quickly as there are lots of options and not all are very clear to what they do.

I have been using eclipse to format my code after each task for a while now. please heeelp! 😊😀

And please don't tell me to switch to Eclipse. because I really like IntelliJ and got used to it.

Top comments (4)

Collapse
 
matmooredev profile image
Mat

Have you tried adopting a 3rd party set of formatting rules that can work with both IDEs? I'm currently investigating the same thing for my team and a few people have recommended following Google's style guide, which comes with configuration for both eclipse and intellij: github.com/google/styleguide

Collapse
 
bassemibrahim profile image
Bassem

That's a totally valid way to fix this, thanks for your comment 😊. But I would keep changing my team's Eclipse options as a last resort.

Collapse
 
raulvillalbamedina profile image
Raúl Villalba medina

You could use this maven plugin to execute in both ides.
The format file is in eclipse format, is very easy to use

net.revelc.code.formatter
formatter-maven-plugin

Collapse
 
bassemibrahim profile image
Bassem

I had some problems with the plugin at first. But once I added eclipse XML config exported file to it. Formating in no longer an issue.

But I still run into some hiccups like wildcard imports.