palantir / palantir-java-format

A modern, lambda-friendly, 120 character Java formatter.
Apache License 2.0
403 stars 43 forks source link

Spotless apply has different import order compared to intellij plugin #1090

Closed thijmenketel closed 1 month ago

thijmenketel commented 1 month ago

What happened?

Import order with intellij plugin causes mvn spotless:check to fail on imports. The intellij plugin formats like this:

import lombok.Builder;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;

import java.time.Duration;
import java.time.Instant;
import java.time.ZonedDateTime;
import java.util.Collection;
import java.util.List;
import java.util.Optional;

import static java.lang.Boolean.TRUE;
import static java.time.temporal.ChronoUnit.MINUTES;
import static java.util.function.Predicate.not;

While mvn spotless:apply wants it like this:

import static java.lang.Boolean.TRUE;
import static java.time.temporal.ChronoUnit.MINUTES;
import static java.util.function.Predicate.not;

import java.time.Duration;
import java.time.Instant;
import java.time.ZonedDateTime;
import java.util.Collection;
import java.util.List;
import java.util.Optional;
import lombok.Builder;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;

What did you want to happen?

The formatting from the intellij plugin needs match the spotless formatting.

thijmenketel commented 1 month ago

Seems like a duplicate of https://github.com/palantir/palantir-java-format/issues/1088