javawindowsmaven-2netbeanscheckstyle

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


I'm working with a Maven (jar) Project in Netbeans (Windows), which creates Checkstyle reports with the Maven Checkstyle plugin.

No matter what I do, I always get the message: File does not end with a newline for Java class files.

What can I do/configure in either Netbeans or Checkstyle to get rid of the message ?

Versions of used software:


Solution

  • 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>