Search code examples
javamavenformatter

mvn clean install throwing an error - File has not been previously formatted. Please format file and commit before running validation


After I created new files, I started getting the error "Failed to execute goal net.revelc.code.formatter:formatter-maven-plugin:2.8.1:validate File has not been previously formatted. Please format file and commit before running validation".

Any ideas why this error shows up and how to fix it?


Solution

  • Running

    mvn clean validate -P format
    

    fixed the issue.