Is it possible for intellij to organize imports the same way as in Eclipse?

Intellij Idea

Intellij Idea Problem Overview


I'm working on a project where all the team members are using Eclipse and I'm the only IDEA user. This creates a lot of noise from imports rearrangements. The order in which eclipse imports is: Java, Javax, Org, Com, everything else in alphabetical order. Is it possible to configure IDEA to follow these rules?

Intellij Idea Solutions


Solution 1 - Intellij Idea

Some more details: I ended up performing these steps to match out of the box eclipse organizing:

(in Settings > Editor > Code Style > Java > imports, as mentioned by @yole)

  • set "class count to use import with '*'" to 99 (seems like you cannot turn this off)

  • set this ordering for Import Layout (like eclipse defaults):

      static all other, 
      blank, 
      java.*, 
      blank, 
      javax.*, 
      blank, 
      org.*, 
      blank, 
      com.*, 
      blank, 
      all other imports
    

FWIW, there is an Intellij plugin called "eclipse code formatter" that I evaluated for this purpose and ended up discarding, because it set up a separate shortcut (in OSX) that was already in use by core IDE functionality.

Solution 2 - Intellij Idea

Settings | Editor | Code Style | Java | Imports | Import Layout

Solution 3 - Intellij Idea

The best way is to use Eclipse Code Formatter plugin.

Solution 4 - Intellij Idea

In update to Max's answer, the correct order for resolving the checkstyle warnings. I updated the following in IntelliJ:

static all other, 
blank 
com.*
java.* 
javax.*
org.*  
all other imports

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionrgrinbergView Question on Stackoverflow
Solution 1 - Intellij IdeaMaxView Answer on Stackoverflow
Solution 2 - Intellij IdeayoleView Answer on Stackoverflow
Solution 3 - Intellij IdeaMeoView Answer on Stackoverflow
Solution 4 - Intellij IdeaAbhishek BalaniView Answer on Stackoverflow