java - 如何解决 maven-formatter-plugin 的问题?
问题描述
我在 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>
解决方案
推荐阅读
- mysql - 将 Db 迁移到新服务器
- java - Spring Boot - @SQSListener 和 @SpyBean 没有一起工作?
- c++ - c++ 在调用其构造函数之前访问静态/全局对象的成员是否有效?
- javascript - 修改一个 PrimeReact 模块
- javascript - 使用 addEventListener 覆盖模块中的属性的问题
- wordpress - 使用 user_register 挂钩中的自定义元值更新 WooCommerce billing_phone
- c# - 用于优化 Skip() Take() 的 LINQ 扩展
- c# - 选择所有列并返回 EF Core、.NET Core 中的给定类型
- multithreading - 如何在线程之间共享变量或以其他方式处理此逻辑?
- html - 应用边框顶部效果