I want to ensure CRLF (Windows style) line separator in my project. I am checking a few alternatives, but not sure which one is the best for this.
Desired Behavior:
If a file is not CRLF, which IntelliJ IDEA shows at the bottom:
I want my maven profile, let's say mvn clean install -P tests to fail, saying something like "Invalid line separator, not CRLF"
Thanks a lot.
I don't think it is possible to cause the Maven build to fail due to invalid line separators in your project's files unless someone has created a plugin to do that. However, you can configure a code inspection in Intellij IDEA to fail for that reason. This is how you could provoke such a failure:
JetBrains has an open bug ticket to force compilation failure based on inspection errors, so this approach is not exactly what you were asking for. But in the absence of any Maven-based solution it might be best you can do. See the Code Inspection documentation from JetBrains for more information.
One other possible approach is to look at TeamCity, another JetBrains tool for continuous integration. I haven't used it, but perhaps it allows you to configure failure when there are inspection errors (though from a quick look at their documentation I couldn't see how).
Update:
It looks like TeamCity might be worth a look after all. Its documentation on Build Failure Conditions states:
When using code examining tools in your build, like code coverage, duplicates finders, inspections and so on, your build generates various numeric metrics. For these metrics you can specify a threshold which, when exceeded, will fail a build.