revelc / formatter-maven-plugin

Formatter Maven Plugin
https://code.revelc.net/formatter-maven-plugin
Apache License 2.0
286 stars 90 forks source link

Support 'windows' users for contributions #847

Open hazendaz opened 6 months ago

hazendaz commented 6 months ago

When building, the pom.xml after recent updates keeps wanting to become LF not CRLF on windows. This needs fixed. I'm not clear what is causing it but 'git add .' restores it.

ctubbsii commented 2 months ago

This is coming from the parent POM's sortpom plugin. The line ending is specified to be LF. It should be checked in as LF, and stay LF. It should never change to CRLF. I suggest Windows users use a text editor or an IDE that understands LF line endings, such as Notepad++ or Eclipse or IntelliJ, and not rely on tools that magically convert line endings via git checkin and checkout, because while those might work for git activity, it will be a problem when they try to run the code standardization tools (formatter, impsort, sortpom, etc.) which are run as part of the build.

One workaround, if users really don't want to do this is to simply build without the autoformat profile active, which I've made very convenient to do in the parent POM by using separate profiles (-P!autoformat or -Drevelc.skipFormat).