12

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

Lahiru Chandima
  • 22,324
  • 22
  • 103
  • 179

3 Answers3

2

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.

Community
  • 1
  • 1
Alex
  • 367
  • 1
  • 3
  • 17
1

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

0

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)

MuffinTheMan
  • 1,509
  • 20
  • 25