Common import's order for IntelliJ and Eclipse using google-java-format

175 views Asked by At

In our team we're using IntelliJ and Eclipse. As formatter we're plugins for Eclipse and IntelliJ from v1.18.1 of https://github.com/google/google-java-format

We set the same imports layouts for both IDEs:

Eclipse import layout

IntelliJ import layout

There are differences in imports order:

Imports in IntelliJ:

import com.domain.sap.IF.helper.DocumentHelper;
import com.domain.sap.SapUtility;
import com.domain.sap.SyncDocument;

Imports in Eclipse:

import com.domain.sap.SapUtility;
import com.domain.sap.SyncDocument;
import com.domain.sap.IF.helper.DocumentHelper;

For me it looks like IntelliJ uses a Code Formatter also for Imports formatting and Eclipse uses it's own mechanism. How to make it common?

1

There are 1 answers

1
LMC On

Try using a .editorconfig file on the project. IntelliJ has native support and Eclipse requires a plugin.

It will allow to set a lot of import related configurations like

ij_java_imports_layout = *,|,javax.**,java.**,|,$*