Cosium / git-code-format-maven-plugin

A maven plugin that automatically deploys code formatters as pre-commit git hook

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Unable to mvn install project because of formatter problems

northerndeveloper opened this issue · comments

Hello

I am not able to mvn install project after adding plugin git-code-format-maven-plugin due to formatting issues of a class. I believe that I have formatted it correctly but during the install I get the error below :

"Failed to execute goal com.cosium.code:git-code-format-maven-plugin:2.6:validate-code-format (validate-code-format) on project dispatcher: /Users/alperkopuz/BitBucket/dispatcher/dispatcher-service/src/main/java/test/one/TestClass.java is not correctly formatted !"

How I can skip that error during maven install ?

Regards

You can remove validate-code-format execution.
That means removing the following part from your pom.xml or only activate it for a certain maven profile:

<!-- On Maven verify phase, fail if any file
        (including unmodified) is badly formatted -->
      <execution>
          <id>validate-code-format</id>
          <goals>
            <goal>validate-code-format</goal>
          </goals>
        </execution>
      </executions>

when I remove validate-code-format it does not automatically formats the code after pushing it. So therefore removing validate-code-format does not work

Validate-code-format does not refactor the code.

The code is formatted during commit, not push. For that, the precommit hook must have been deployed. The precommit hook is deployed by any maven goal.

Check that you have a precommit hook. Undo the last commit, then commit again.