我在 Windows 系统上构建项目时遇到一些问题。我的项目使用 formatter-maven-plugin 来实现“验证”目标。在将项目推送到 GitHub 之前,我将其格式化并推送。之后,我将其克隆到我的 Windows 计算机上并尝试“mvn clean install”,但我得到:
Failed to execute goal net.revelc.code.formatter:formatter-maven-plugin:2.9.0:validate (default) on project application: File 'C:\Users\AUser\Desktop\demo\application\src\main\java\com\myapp\Application.java' has not been previously formatted. Please format file and commit before running validation!
在 Linux 中不存在这个问题。这是为什么?在推送 Git 之前,我对它进行了格式化。为什么linux上不存在这个问题?我无法更改格式目标。
<plugin>
<groupId>net.revelc.code.formatter</groupId>
<artifactId>formatter-maven-plugin</artifactId>
<version>2.9.0</version>
<executions>
<execution>
<goals>
<goal>validate</goal>
</goals>
<configuration>
<configFile>${project.basedir}/../eclipse/eclipse-formatter.xml</configFile>
<encoding>UTF-8</encoding>
</configuration>
</execution>
</executions>
</plugin>
最佳答案
关于java - 如何解决 maven-formatter-plugin 的问题?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56670074/