IntelliJ IDEA 13: Importing Code Formatter Settings from Eclipse

Many development teams are using more than one IDE because it’s a very personal matter, and people always seek what best suits their individual needs. And then there’s collaboration, and it sometimes is harder when different sorts of IDEs are involved. One of the most frequently encountered problems is code style, that has to be consistent in the entire project.

You may have heard about Eclipse Code Formatter, a quite popular IntelliJ IDEA plugin that lets you, what else, — use Eclipse’s code formatter with IntelliJ IDEA. In most cases the plugin is fine, but because it’s calling Eclipse API directly from IntelliJ IDEA, there can be problems with processing such actions as refactoring, code generation, etc., so it’s not always that helpful.

Now things are going to be a bit easier, because IntelliJ IDEA 13 is capable of importing code formatter settings from Eclipse without the use of any plugins. All you need is to export settings from Eclipse (go to Eclipse’s PreferencesJavaCode StyleFormatter and export the settings to an XML file via the Export All button.), and then open IntelliJ IDEA SettingsCode StyleJava, click Manage, and import that XML file by simply clicking Import.

Currently, IntelliJ IDEA supports the import of the following settings:

  • General
    • Right margin, Formatter on/off tags
    • Indentation
    • Indent size
    • Usage of ‘Tab’ character
    • Usage of Tab only for leading indentation (Smart Tabs)
    • Indent ‘case’ branches from ‘switch’
    • Indent class members
    • Keep comment at first column
  • Spaces (Java)
    • Before/after comma (as set for Eclipse method declaration parameters)
    • After comma in type arguments
    • Within array initializer braces
    • Within brackets (in array reference)
    • Within parentheses of: annotation, ‘for’, ‘if’, ‘catch’ ’while’, ’switch’, method, empty method, parenthesized expression, method call, type cast, ‘synchronized’
    • Before parentheses of: ‘try’, ‘for’, ’while’, ‘switch’, method, ’if’, ‘catch’, method, method call, ‘synchronized’.
    • After type cast
    • Around unary, assignment operators (if it’s set for ‘before’ and ‘after’ in Eclipse).
    • Before opening brace of: array initializer, ‘switch’
    • Before ‘?’ in conditional expression
    • Space before/after ‘:’ in conditional expression
    • Space around binary operators (a single Eclipse setting is mapped to multiple IntelliJ IDEA’s settings)
  • Blank lines
    • Around fields and methods
    • Before/after package
    • Before/after imports
    • Before method body
    • Keep blank lines in code (number of empty lines to preserve)
  • Wrapping
    • New line before: closing brace in array initializer, ‘else’ in ‘if’ statement, ‘finally’ and ‘catch’ in ‘try’ statement, binary operator (if wrapped)
    • New line after:  opening brace in array initializer
    • Special ‘else if’ treatment (compact ‘else if’)
    • Keep simple blocks in one line
    • Keep control statements in one line
  • Alignment of: array initializer expressions, arguments in method declarations and calls, field declarations, extends list, assignments, binary expressions, ‘throws’ clause, resources in ‘try’.
  • Brace style for: code blocks, methods and classes
  • JavaDoc
    • Enable JavaDoc formatting
    • Blank lines in JavaDoc

Keep in mind that code style settings in IntelliJ IDEA and Eclipse are fundamentally different and can’t be mapped one to another with complete accuracy, e.g. you can’t tell IntelliJ IDEA to put space after ‘(‘ or not to put it before ‘)’. However, we’re constantly working on improving this interoperability, and your feedback with problems and use cases is very appreciated.

What’s planned for the nearest future:

  • More settings (based on your feedback, tell us what’s important for you.)
  • More languages.
  • Working directly with .settings/org.eclipse.jdt.core.prefs, without the need to use the XML export/import.
  • Importing of Conventions (from “Java Code Style”), e.g. field prefixes.
  • Importing of Code templates and Organize imports settings.

Feel free to share your feedback here, or in our discussion forum, or issue tracker.

Develop with Pleasure!

Comments below can no longer be edited.

42 Responses to IntelliJ IDEA 13: Importing Code Formatter Settings from Eclipse

  1. Avatar

    Henning says:

    January 31, 2014

    That is a great feature for teams using both IDEs (and I hadn’t noticed it so far, so thanks for this blogpost)!

    What I’m currently missing most is an option to mirror the Eclipse formatter’s behaviour regarding imports: Grouping imports by their top level package, inserting a blank line between groups, but sorting other packages between the groups (effectively, giving more than one “other” group).

    It’s not that I particularly like that scheme, I just can’t force all Eclipse users to alter their default settings…

  2. Avatar

    Meo says:

    January 31, 2014

    Eclipse Code Formatter plugin to the rescue! 🙂

    I found that it works nicely with the plugin together, because Eclipse API is actually not used for actions as refactoring, code generation, etc, so it helps if the code style in IntelliJ is similar to the Eclipse one.

  3. Avatar

    mooli says:

    February 3, 2014

    imports support needed here too.
    (specifically order e.g java;javax;org;com;)

    This feature will become relevant for us at ovirt [1] when/if it is supported:

    Until then it seems we must use eclipse code formatter plugin [2].

    [1] http://www.ovirt.org/Home
    [2] http://www.ovirt.org/Building_oVirt_Engine/IDE#IntelliJ

  4. Avatar

    Bert says:

    February 4, 2014

    Must be doing something false, but I do not have the import button. And this was one of the main reasons to upgrade 🙁

    Any ideas what I might be doing wron?

    • Avatar

      Andrey Cheptsov says:

      February 4, 2014

      Can you share a screenshot?

      • Avatar

        Bert says:

        February 4, 2014

        Idea Version 13.0.2

        screen can be found here

        thanks for looking into it

        • Avatar

          Alexander Chernikov says:

          February 7, 2014

          Please check is the Eclipse Integration plugin enabled. Try to enable, if not.

  5. Avatar

    Antoine Sabot-Durand says:

    February 8, 2014

    Great feature. Yet I have still formatting issue in Javadoc.
    When you format javadoc empty line under eclipse, it adds a space after * while IntelliJ puts carriage return directly after *.

    Quite stupid issue but enough to add false changes to push to VCS. If you have a trick to fix that it would be awesome.

    • Avatar

      flogy says:

      July 6, 2015

      I have the exact same issue. Have you found a solution for this in the meantime? Would be awesome!

  6. Avatar

    Bert says:

    February 10, 2014

    No need to check, I know that I have not enabled the Eclipse plugin. If this is needed, than please correct the post. In the moment, it reads:

    “Now things are going to be a bit easier, because IntelliJ IDEA 13 is capable of importing code formatter settings from Eclipse without the use of any plugins. ”

    Thank you for your input

  7. Avatar

    Patrick Dezenzio says:

    February 14, 2014

    Great tool but you need to be careful when upgrading. I upgraded from 12 to 13 and it’s taken all morning trying to figure out why the formatter doesn’t work. It keeps displaying a message that the settings file doesn’t exist and the location points to Intellij12, not Intellij13. I even wen tin a set the default to my file located in the .intellij13 folder. Doing a search for a file that contains the old setting and set it there. I uninstalled 12 so that’s why the folder doesn’t exist.

  8. Avatar

    Patrick Dezenzio says:

    February 14, 2014

    Ok, the culprit is the misc.xml file under your project folder – .idea. I can see the line that points to the formatter file but the path name shows .intellij12. Changing this to .intellij13 works until you start up Intellij and something is changing the value back. Where in the world is Intellij getting .Intellij12? It doesn’t exist. I might have to dump intellij for MyEclipse until I figure this out because the normal formatting is screwing up the team.

  9. Avatar

    Patrick Dezenzio says:

    February 14, 2014

    I found it!! Ignore this tutorial. There are 2 places you can set the formatting and the place you want to change it is under Eclipse Code Formatter, not Code Style. You can see it under Settings.

  10. Avatar

    Shehan Simen says:

    March 4, 2014

    This is really great. I was looking for this for years. Thanks a lot to IDEA

  11. Avatar

    Luca Garulli says:

    March 19, 2014

    Eclipse Code Formatter doesn’t work with last IntelliJ 13.1, help!

  12. Avatar

    Mohamed Mounirou says:

    March 31, 2014

    You need to install the “Eclipse Integration Plugin” first to have the “import” button

    • Avatar

      Lars Bohl says:

      March 6, 2015

      Indeed. The blog post is wrong in saying “IntelliJ IDEA 13 is capable of importing code formatter settings from Eclipse without the use of any plugins”. I’ve lost some time looking for an “Import…” button that isn’t there.

  13. Avatar

    Ted says:

    April 16, 2014

    Currently working on a very Eclipse heavy team with a formatting set that doesn’t seem to map completely to IntelliJ.

    I’d be happy to help with listing the issues I have (of which I seem to have quite a few) if it’d help.

    As it is now I have to keep Eclipse open for the formatting only, which is a pain. The import rules I’ve sorted manually, so that’s not an issue (but would be cool if they also could be imported automagically)

    I’ll give the Eclipse Code Formatter plugin a try – but the optimal solution would obviously be to use IntelliJ functionality alone without having to use the Eclipse monstrosity behind the scenes.


    • Avatar

      Vojtěch Krása says:

      August 31, 2016

      There is no Eclipse monstrosity behind the scenes, with the Eclipse Code Formatter plugin.

  14. Avatar

    tang says:

    April 17, 2014

    How to use two different formatter files

  15. Avatar

    Michel says:

    February 3, 2015


    I have Intellij 14.0.1, for some reason when I try to import the XML it gives me the following error: “Eclipse XML Profile import failed with error message: org.xml.sax.SAXException: Unknown XML element: code_scheme”,

    even though the XML is valid and correct!

    Please help

    • Avatar

      yz says:

      July 3, 2015

      I encounter the same error 🙁 Do you how to fix it now?

      • Avatar

        M T says:

        September 28, 2015

        I have the same problem as well! Anybody have a solution?

        • Avatar

          Mike says:

          February 25, 2016

          Me as well.

    • Avatar

      Maksim Sobolevskiy says:

      September 29, 2015

      Hi, Michel! Have you created an issue on our issue tracker?

    • Avatar

      Alex_Sh says:

      October 26, 2015

      Same problem ((

      • Avatar

        Maksim Sobolevskiy says:

        October 26, 2015

        Hi, Alex! As I asked above, could you please make an issue in our tracker? It makes able for you to give us your XML as a example therefore we will be able to fix the bug.

        • Avatar

          erez says:

          December 13, 2015

          do you have a solution for this issue?

          • Avatar

            wanwt says:

            November 24, 2016

            try import the xml file by plugin Eclipse Code Formatter

  16. Avatar

    raleigh says:

    December 7, 2015

    any plans on making an Export feature to do the reverse? Export IDEA’s code style settings to Eclipse or other tools such as Uncrustify.

    A compromise might be to have a small(ish) utility that code be invoked from the command line or from a build script.

  17. Avatar

    Michael says:

    January 15, 2016

    The bug is still there. Eclipse XML Profile import failed with error message: org.xml.sax.SAXException: Unknown XML element: code_scheme. Intellij does not accept any code style xml. I am using latest version of intellij 15. To duplicate this problem, export a code style xml from intellij and re-import it back into intellij, and it won’t accept any thing.
    Can Jetbrains please fix this bug?

  18. Avatar

    Mac says:

    March 22, 2016

    Workaround: copy formatter xml file to {user.home}\.IntelliJIdea15\config\codestyles and restart IntelliJ Idea. After restart formatter fill be available in dropdown list.

  19. Avatar

    gaglin says:

    March 22, 2016

    The bug seems still there. Can Jetbrains please fix it? Thank you very much!

  20. Avatar

    Zakie Mashiah says:

    April 10, 2016

    For whatever it’s worth, I think a critical thing is to ensure that when two different team members that are using different IDE and are touching the same sources do not get ridiculously large difference between check-ins because the editors they use align text slightly different. I did find the Eclipse formatter to be useful in identifying silly code mistakes, and would be nice to reach same level of functionality across IDEs

  21. Avatar

    marvin jensen says:

    June 3, 2016

    I am unable to get a new code style xml file to load. I tried importing it and tried copying the file to the same location where a previously imported (different release of intellij) file was imported: C:\Users\\.IntelliJIdea15\config\codestyles

    Nothing seems to work.

    This is a huge problem since I work on a team of 15 or so developers and each time someone with a different formatter checks in code we all get a huge diff when comparing when in reality only a line or two has changed.

    Please fix this issue and in the mean time please PROVIDE A WORKAROUND IF THERE IS ONE

  22. Avatar

    Vasiliy says:

    June 17, 2016

    Is it possible to tune space before/after the colon in the for-each loop? For example:

    for (String s: collection) {



    for (String s : collection) {



    for (String s:collection) {


  23. Avatar

    Dave says:

    August 21, 2016

    As you can see in the comments above this feature has been broken for years without a reply from JetBrains.

    I have a work around that gets the job done for me though. When I export a formatting xml file from Eclipse and I attempt to import it in Intellij as an Eclipse XML Profile I get the same error as noted in previous coments, “Eclipse XML Profile import failed with error message: org.xml.sax.SAXException: Unknown XML element: code_scheme”.

    However, I have found that if you import the Eclipse formatting file as an “Intellij IDEA code style XML” import (even though it was actually exported from eclipse) then, suprisingly, it works.

    • Avatar

      Jim Thompson says:

      March 14, 2017

      How do you do that?

  24. Avatar

    Vojtěch Krása says:

    August 31, 2016

    Just use Eclipse Code Formatter plugin.

  25. Avatar

    Rajaram Agaram says:

    August 30, 2017

    I got it working by copying over the plugin xml to ~/Library/Preferences/IdeaIC15/codestyles on a mac. Restarting Intellij after putting the plugin in place will then show ‘GoogleStyle’ as a dropdown option.

  26. Avatar

    Moira Katowicz says:

    February 5, 2018

    I use this data model for years. I first found it on dev.mysql.com few years back. I have structures many levels deep and data with hundreds of rows – It never fails, it’s really fast. The ability to cut part of the structure with one question is simply awesome! It is part of my framework now with full credit to Mike of course Thank you so much for sharing.


Discover more