How to get rid of Checkstyle message ‘File does not end with a newline.’

Put a newline at the end of the file
or
configure CheckStyle not to care.

<module name="Checker">
    <!-- stuff deleted -->
    <module name="NewlineAtEndOfFile">
        <property name="severity" value="ignore" />
    </module>


You also have to tell the Maven Checkstyle plugin to use your checkstyle config file.

<plugin>
    <artifactId>maven-checkstyle-plugin</artifactId>
    <configuration>
        <configLocation>${basedir}/yourCheckstyle.xml</configLocation>
    </configuration>
</plugin>

Leave a Comment