在 Windows 上执行命令“mvn clean package -DskipTests”编译时报如下错误,原因是 Windows 默认为“\r\n”。解决办法是在仓库的根目录下创建名为“.gitattributes”的文件,添加一行内容:
* text eol=lf
也可只针对指定文件类型:
*.java text eol=lf
注意将“.gitattributes”放在和文件“.gitignore”同目录下,即仓库的根目录下。
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal com.diffplug.spotless:spotless-maven-plugin:2.4.2:check (spotless-check) on project flink-connector-debezium: The following files had format violations:
[ERROR] src\main\java\com\ververica\cdc\debezium\DebeziumDeserializationSchema.java
[ERROR] @@ -1,40 +1,40 @@
[ERROR] -/*\n
[ERROR] - * Licensed to the Apache Software Foundation (ASF) under one\n
[ERROR] - * or more contributor license agreements. See the NOTICE file\n
[ERROR] - * distributed with this work for additional information\n
[ERROR] - * regarding copyright ownership. The ASF licenses this file\n
[ERROR] - * to you under the Apache License, Version 2.0 (the\n
[ERROR] - * "License"); you may not use this file except in compliance\n
[ERROR] - * with the License. You may obtain a copy of the License at\n
[ERROR] - *\n
[ERROR] - * http://www.apache.org/licenses/LICENSE-2.0\n
[ERROR] - *\n
[ERROR] - * Unless required by applicable law or agreed to in writing, software\n
[ERROR] - * distributed under the License is distributed on an "AS IS" BASIS,\n
[ERROR] - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n
[ERROR] - * See the License for the specific language governing permissions and\n
[ERROR] - * limitations under the License.\n
[ERROR] - */\n
[ERROR] -\n
[ERROR] -package com.ververica.cdc.debezium;\n
[ERROR] -\n
[ERROR] -import org.apache.flink.annotation.PublicEvolving;\n
[ERROR] -import org.apache.flink.api.java.typeutils.ResultTypeQueryable;\n
[ERROR] -import org.apache.flink.util.Collector;\n
[ERROR] -\n
[ERROR] -import org.apache.kafka.connect.source.SourceRecord;\n
[ERROR] -\n
[ERROR] -import java.io.Serializable;\n
[ERROR] -\n
[ERROR] -/**\n
[ERROR] - * The deserialization schema describes how to turn the Debezium SourceRecord into data types\n
[ERROR] - * (Java/Scala objects) that are processed by Flink.\n
[ERROR] - *\n
[ERROR] - * @param <T> The type created by the deserialization schema.\n
[ERROR] - */\n
[ERROR] -@PublicEvolving\n
[ERROR] -public interface DebeziumDeserializationSchema<T> extends Serializable, ResultTypeQueryable<T> {\n
[ERROR] -\n
[ERROR] - /** Deserialize the Debezium record, it is represented in Kafka {@link SourceRecord}. */\n
[ERROR] - void deserialize(SourceRecord record, Collector<T> out) throws Exception;\n
[ERROR] -}\n
[ERROR] +/*\r\n
[ERROR] + * Licensed to the Apache Software Foundation (ASF) under one\r\n
[ERROR] + * or more contributor license agreements. See the NOTICE file\r\n
[ERROR] + * distributed with this work for additional information\r\n
[ERROR] + * regarding copyright ownership. The ASF licenses this file\r\n
[ERROR] + * to you under the Apache License, Version 2.0 (the\r\n
[ERROR] + * "License"); you may not use this file except in compliance\r\n
[ERROR] + * with the License. You may obtain a copy of the License at\r\n
[ERROR] ... (32 more lines that didn't fit)
[ERROR] Violations also present in 24 other files.
[ERROR] Run 'mvn spotless:apply' to fix these violations.
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
[ERROR]
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR] mvn <args> -rf :flink-connector-debezium
标签:License,Windows,ERROR,Spotless,file,under,apache,org,换行符
From: https://www.cnblogs.com/aquester/p/17187018.html