Lahiru Chandima
Lahiru Chandima

Reputation: 24128

Export Intellij IDEA code formatting rules to Eclipse

Is there a way to generate a eclipse code formatter xml which matches Intellij IDEA code formatting rules?

Upvotes: 12

Views: 4961

Answers (3)

MuffinTheMan
MuffinTheMan

Reputation: 1581

Try this:

  1. In IntelliJ, File -> Settings -> Editor -> Code Style -> Java, click the gear icon then Export -> Eclipse XML Profile: enter image description here
  2. In Eclipse, Window -> Preferences -> Java -> Code Style -> Formatter -> Import; ensure your imported profile is selected as the Active profile and Apply:enter image description here

Screenshots are from IntelliJ IDEA 2022.3.2 (Community Edition) and Eclipse 2022-03 (4.23.0)

Upvotes: 1

Alex
Alex

Reputation: 377

If CheckStyle is an option for you, consider using it as 'single source of truth':

  • create CheckStyle config
  • install CheckStyle plugins in both Eclipse and IDEA
  • import formatter configs from CheckStyle config

See answers to related question.

I haven't tried it yet.

Upvotes: 2

Albert Casanovas
Albert Casanovas

Reputation: 254

At the moment there is no way to export IntelliJ code style to eclipse. You need to do it the other way around.

You can also check IntelliJ plugin called "Eclipse Code Formatter" (link), but it the same way, from Eclipse to IntelliJ.

I'm using IntelliJ 14.1.4

Upvotes: 1

Related Questions