1

I am having a problem with spotless, when applied to a file with a text block.

I am using the following configuration for spotless in pom.xml. However, using eclipse java formatter has similar (but not exactly the same) problems.

<plugin>
    <groupId>com.diffplug.spotless</groupId>
    <artifactId>spotless-maven-plugin</artifactId>
    <version>2.43.0</version>
    <configuration>
        <java>
            <googleJavaFormat>
                <version>1.17.0</version>
            </googleJavaFormat>
            <indent>
                <tabs>true</tabs>
                <spacesPerTab>2</spacesPerTab>
            </indent>
            <indent>
                <spaces>true</spaces>
                <spacesPerTab>4</spacesPerTab>
            </indent>
        </java>
    </configuration>
</plugin>

This java file is not getting formatted correctly, i.e., the extra spaces stay, for spotless:apply

class SomeTest {

    @Test
    void test()     {
        assertThat("""
                
                """).isEqualTo("\n");
    }
}

This java file is getting formatted correctly, i.e., the extra spaces are removed, for spotless:apply

class SomeTest {

    @Test
    void test()     {
        assertThat("\n").isEqualTo("\n");
    }
}
1

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.