I would like to enforce Unix style end-of-line (\n) in Java sources of our projects for consistency reasons. As many of us work under Windows, most IDEs are configured by default to use Windows style end-of-line (\r\n). We try to change that settings each time we configure a new workspace but for some reasons, some files are commited with Windows end-of-line.
Is there any Maven configuration or plugin which could help us enforcing the Unix style end-of-line or, at least, warning us of the files that are in Windows style?
I though about PMD or Checkstyle first but it doesn't appear to be that simple. I've also checked Maven Enforcer Plugin but I don't think it do that out-of-the box. I should be able to create my own rule but I'd like to make sure I don't reinvent the wheel :)
Use Checkstyle, we used it successfully in our project to enforce Unix line endings.
You can use a regular expression to do this ( a windows line ending is \r\n, but you probably know that).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With