Git Product home page Git Product logo

Comments (4)

hazendaz avatar hazendaz commented on September 23, 2024 1

See the javadocs

    /**
     * When set to true, remove trailing whitespace on all lines after the formatter has finished.
     * <p>
     * Default to 'true' since 2.18.0
     *
     * @since 2.17.0
     */
    @Parameter(defaultValue = "true", property = "formatter.removeTrailingWhitespace")
    private boolean removeTrailingWhitespace;

If you don't want it on, just set that property to false

from formatter-maven-plugin.

hazendaz avatar hazendaz commented on September 23, 2024

Eclipse doesn't handle javadocs in the formatter but rather in source cleanup. We have the formatter properly handling the trailing space. In fact, if your run the formatter (not validate), it will trim the trailing spaces. This is an enhancement added in recent versions to fix what we see as a defect in how Eclipse handled javadocs whitespace in relation to everything else.

The specific code is in the formater mojo

  // Process the source one more time and remove any trailing whitespace found
                if (this.removeTrailingWhitespace) {
                    formattedCode = FormatterMojo.REMOVE_TRAILING_PATTERN.matcher(formattedCode).replaceAll("");
                }

So yes it would complain if trailing whitespace is present.

from formatter-maven-plugin.

bennypi avatar bennypi commented on September 23, 2024

In my opinion this is not a nice user experience. I understand that you want to improve a defect in Eclipse, but this means that using the formatter in Eclipse or IntelliJ does not mean that the files will pass the maven-formatter-plugin. I guess there is no way to exclude whitespace (In Javadoc) for the validate-goal?

from formatter-maven-plugin.

ctubbsii avatar ctubbsii commented on September 23, 2024

Closing this as answered, since it is already currently possible to tune this feature.

from formatter-maven-plugin.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.