lob*_*lob 3 java eclipse newline file checkstyle
当尝试在我的项目上使用 mvn clean install 时,我收到这些错误:
[ERROR] C:\Users\lob\Downloads\zanata-platform-platform-4.0.0\zanata-platform-platform-4.0.0\parent\eclipse-code-formatter-js.xml:0: File does not end with a newline. [NewlineAtEndOfFile]
[ERROR] C:\Users\lob\Downloads\zanata-platform-platform-4.0.0\zanata-platform-platform-4.0.0\parent\eclipse-code-formatter.xml:0: File does not end with a newline. [NewlineAtEndOfFile]
[ERROR] C:\Users\lob\Downloads\zanata-platform-platform-4.0.0\zanata-platform-platform-4.0.0\parent\pom.xml:0: File does not end with a newline. [NewlineAtEndOfFile]
[ERROR] C:\Users\lob\Downloads\zanata-platform-platform-4.0.0\zanata-platform-platform-4.0.0\parent\README.txt:0: File does not end with a newline. [NewlineAtEndOfFile]
Audit done.
[INFO] There are 4 errors reported by Checkstyle 7.2 with zanata-build-tools/checkstyle.xml ruleset.
[ERROR] eclipse-code-formatter-js.xml:[0] (misc) NewlineAtEndOfFile: File does not end with a newline.
[ERROR] eclipse-code-formatter.xml:[0] (misc) NewlineAtEndOfFile: File does not end with a newline.
[ERROR] pom.xml:[0] (misc) NewlineAtEndOfFile: File does not end with a newline.
[ERROR] README.txt:[0] (misc) NewlineAtEndOfFile: File does not end with a newline.
Run Code Online (Sandbox Code Playgroud)
将段落或 \n 放在这些文件的末尾并不能解决此问题。在 Eclipse 下, Window >> Preferences >> Checkstyle >> Select the configuration file >>这些文件未列出。
使用:
长话短说:
git config core.autocrlf true.gitgit reset --hard HEAD细节和根本原因:
Git 行结束配置
Windows 上的 Git 配置是此错误的根本原因。zanata-platform-platform它是用 Unix 风格的行结尾构建的。在 Windows 中,maven 会将 Unix 风格的行结尾误解LF为不正确的 Windows 行结尾CRLF。
第一步是重新配置 Windows 上安装的 git,以便在 git 生成文件时替换LF为CRLF. 在 Windows 上,您可以使用以下命令编辑文件,CRLF但此配置告诉 git 在您提交或推送时进行CRLF转换LF。
删除所有文件,同时保留.git包含历史记录的目录
让 git 新生成带有 Windows 风格行尾的文件。
| 归档时间: |
|
| 查看次数: |
15655 次 |
| 最近记录: |